0
votes

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
1
@PavelOganesyan: I don't see a duplicate to that question as each worker only accesses the (indM,:,:,:) slice. - Daniel
@PavelOganesyan - That is not the right duplicate. The one by Daniel is the correct one, which I have selected to be the final duplicate. - rayryeng
@rayryeng: I don't see the other questions as duplicates. Here, we have the very simple case of not slicing along the last dimension, whereas the other dupes were about more complex issues. Consequently, I have reopened the question. - Jonas
@Jonas understood. Thanks - rayryeng

1 Answers

1
votes

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]);