My code has the following form:
clear all
rng('shuffle')
runtables = importdata('runtable.mat');
numfiles = numel(runtables(:,1));
runind = 3000:numfiles;
[O,P,normx,normy,normz,refractmat,away_area] = importraddata3Dphaseadhoc(5,mindist_thresh,[1 1 1 1 1],[1 1 1 1 1]);
nummods = numel(runind);
runtables2 = runtables(runind,:);
parfor j=1:nummods
curmodel = runind(j);
param1 = runtables2(j,1);
param2 = runtables2(j,2);
parsave(savefilename,Esum,extdisti,extdist,Estp,freq_min,freq_max,radintensity,polys,effk);
end
My problem is that the code works perfectly fine when run on a local machine with 16 cores. However, having tried to run the code on a cluster, I have been unsuccessful. The problem is that when it gets to the parfor line (parfor j=1:nummods) it returns the error:
Index exceeds matrix dimensions
I have no idea why this occurs. On the other hand, the code runs correctly if I modify the code such that nummods==1.
The following link seems to address a problem like the one I am experiencing:
http://www.mathworks.com/matlabcentral/answers/224150-index-exceeds-matrix-dimensions-error-when-using-parfor
but, I do not understand what to do, and I do not understand why my code works perfectly on a single multi-core machine but fails on a cluster.
Thanks.