Trouble with parfor due to the way of indexing a cell

1 view (last 30 days)
I tried to write the constructor for the Class Analysis I defined. One of its property e is a cell and each element of the cell is a instance of another class Ephys. In the constructor, I wrote a nested for-loop to instantiate each element of e. To accelerate, I used parfor for the inner for-loop but the editor reported that the PARFOR Loop cannot run due to the way variable 'a' is used.
I can't figure out the reason why parfor doen't work, because each element of a.e seems to be independently accessed. Any ideas? Or any other ways to accelerate?Thank you so much!
classdef Analysis
properties
e
end
methods
function a = Analysis(path_txt, path_plx, folder_wav)
neurons = Spike.split(path_txt);
songs = Sound.split(folder_wav);
t = Trigger(path_plx);
for m = 1: length(neurons) % nested for loop, layer 1
sp = Spike(neurons{m});
parfor n = 1: length(songs) %layer 2, where I used parfor
so = Sound(songs{n});
a.e{m,n} = Ephys(sp,t,so);
end
end
end
end
end

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!