any way to add a switch for spmd command in matlab?
===

I am using matlab2011 for parallel calculation with multiple cores, which in my code is simply implemented with the block SPMD END. However, for some times, I want to turn off the spmd in the program based on the input parameter. I try the following code, but it doesn't work

    if (switchSpmdOn)
      spmd
    end
    % here I put my code for calculation in parallel or series
    if (switchSpmdOn)
      end % this end is used to close the spmd block
    end

I am wondering if there is anything like marco to turn off spmd in the code.