All,
I met a very interesting situation on my parfor run on matlab, and following is my question.
fid = 'test.nc';
temp = ncread(fid,'temp');
[s1,s2,s3] = size(temp);
for m = 1 : 100
parfor xid = 1 : s1
for yid = 1 : s2
output = struct;
output.t = squeeze(temp(xid,yid,:));
if ~isnan(temp(xid,yid,37))
output.t(:) = 1;
else
output.t(:) = nan;
end
temp(xid,yid,:) = output.t;
end
end
end
In this case, I got the error message...
"Error using pwp_parallel (line 238) Error: The variable temp in a parfor cannot be classified.See Parallel for Loops in MATLAB, "Overview"."
However, if my code is looking like this...
fid = 'test.nc';
temp = ncread(fid,'temp');
[s1,s2,s3] = size(temp);
for m = 1 : 100
parfor xid = 1 : s1
for yid = 1 : s2
output = struct;
output.t = squeeze(temp(xid,yid,:));
output.t(:) = 1;
temp(xid,yid,:) = output.t;
end
end
end
The code is running.
Could someone help me to deal with this error?