user1112136
user1112136

Reputation: 31

Matlab Nested parfor loop , variable cannot be classified

I'm trying to run the below code but get an error message:

The variable R in a parfor cannot be classified

Any way to solve it?

R=zeros(M,N,Us,Vs,'single');
parfor indM=1:M   
    for indN=1:N
        for indv=1:Vs           
           temp=squeeze(X(indM,indN,:,indv));          
           if(sum(temp(:)~=0))
             R(indM,indN,:,indv)= FractionalFFT_mid0(temp,a);    
           end
        end
    end
end

Upvotes: 0

Views: 171

Answers (1)

Jonas
Jonas

Reputation: 74940

Older versions of Matlab require that the parfor-sliced index is the last one (newer versions, e.g. 2014b no longer have the requirements).

R=zeros(N,Us,Vs,M,'single');
parfor indM=1:M   
    for indN=1:N
        for indv=1:Vs           
           temp=squeeze(X(indM,indN,:,indv));          
           if(sum(temp(:)~=0))
             R(indN,:,indv,indM)= FractionalFFT_mid0(temp,a);    
           end
        end
    end
end

%# get R back the way you wanted originally
R = permute(R,[4 1 2 3]);

Upvotes: 1

Related Questions