Can a Matlab PARFOR loop be programmatically switched on/off?
问题 Have a simple question about parfor in MATLAB. I would like to set a flag in my program to change between parfor and regular for loops. Basically, I need this functionality so that some parts of my code can update graphics in a "debug" mode, then when the flag is turned off, use parfor with no graphics updates for speed. So, I'm looking for something simple that has this functionality: if (flag) for i = 1:n else parfor i = 1:n end % Do loop tasks. end Any help would be greatly appreciated!