I've got a problem with a parfor loop: when I want to run a code whose structure is very similar to that of the code shown below, I obtain the
Subscripted assignment dimension mismatch error
I run the code with
dbstop if error
and I've observed that the indexes i and j are well iterated but the results aren't avalaible to my wokspace. Do you have any idea?
matlabpool 12;
Nx = 51;
Ny = 53;
Nc = 11;
Ns = randn(Ny,Nx);
Nr = randn(Nc, 2^14);
Ne = randn(1, Nc);
parfor j = 1:Ny
tic
for i = 1:Nx
idx = randi([1,Nc],1,19);
if isempty(idx)
continue
end
a = Nr(idx,:);
b = Ne(idx)';
nrr = sum(bsxfun(@(a, b) a.*b, a, b)/(Ns(j,i)),1);
nrrr(j,i,:) = nrr;
end
toc
end
PS: This code isn't the real one but I can assure you that the types of operations are kept as those in the real one (the real one is found inside a very large script).