Main Content

Run Non-Blocking Code in Parallel Using parfeval

You can execute a function on one or all parallel pool workers, without waiting for it to complete, using parfeval or parfevalOnAll. This can be useful if you want to be able to plot intermediate results. In addition, parfeval allows you to break out of a loop early, if you have established that your results are good enough. This may be convenient, for example, in optimization procedures. Note that this is different from using parfor, where you have to wait for the loop to complete.