Trouble with parfor due to the way of indexing a cell

1 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by