MATLAB: How to switch between parfor and for based on if you have the Parallel Computing Toolbox

Parallel Computing Toolboxswitch parfor for

How can you automatically switch between parfor and for based on if you have the Parallel Computing Toolbox without copying the code within the for loop?

Best Answer

If there is no PCT installed then parfor is accepted but will operate as a for.
Related Question