> Thanks for the comments. I wonder whether "for" or "parfor "inside > "parfor" is allowed. It seems to have some warning.
You cannot nest a PARFOR directly in the text of another PARFOR; you can call a function from within a PARFOR that calls PARFOR - but that doesn't get you any additional parallelism. (The aim here is that you can write a PARFOR loop in your function without having to worry about whether your caller has already started a PARFOR loop). We always currently use all workers for the outermost PARFOR loop.
> One more question: Do I need to call matlabpool each time when I start > the matlab or once I call matlabpool function, it will use the setting > until I change it in the future? In other words, isn't it of necessity > to explicitly write this command in the code if I want to call parfor?
You do need to explicitly open the matlabpool each time you launch MATLAB. Note that there's also "matlabpool('size')" which can tell you if matlabpool is already open.