Is there any possibility to increase the number of cores you use by default?
No, there is no such possibility.
MATLAB's execution engine examines the code to be executed and detects some common patterns of operations. When it finds one it recognizes, it examines the size of the input arrays, and if the input arrays are "big enough" then it calls the high performance multi-threaded (multicore) libraries to do the calculations.
Setting up to call those libraries and setting up appropriate computation threads takes time, so if the computation to be done is small enough, then MATLAB does not bother calling the high performance libraries, and instead does the computation in a single thread. If MATLAB thought that there was performance gains to be had by switching to multiple cores, taking into account that is not free then it would have done so.
When MATLAB executes for long periods with only one CPU in use, then that indicates one of three possibilities:
- The pattern of computations might not be suitable for high performance acceleration using the facilities in the libraries; or
- MATLAB might not be able to recognize the pattern of computations as being able to be done with the high performance libraries due to the way the code is written; or
- MATLAB might have recognized the pattern but realized that the computation is too small for there to be a net benefit from using multiple cores
- Generally speaking, vectorizing operations with larger arrays can often be recognized as something that can be done with the high performance libraries.
- Generally speaking, loops accessing individual elements of arrays are not always recognized as something that can be accelerated, especially if the part that can be accelerated is buried in a bunch of other computations.
- Generally speaking, if there are a lot of if/else then acceleration would not be done.
- Generally speaking, you are advised to code image processing in terms of imfilter() or conv2() instead of equivalent loops, as imfilter() and conv2() call upon special libraries that can use tricks like fft() in order to perform filtering.