parfor and global variables
13 views (last 30 days)
Show older comments
MRC on 1 Nov 2013
Commented: MRC on 4 Nov 2013
Hi, could you help me please in solving this problem? I need to use parfor and at the same time the function simuconf inside parfor uses global variables. I have read other similar questions but I haven't been able to find a solution. Thanks a lot!
A=load(['subdata' mstr '.mat']); %At each iteration I load subdata(w)
E=load(['freq' mstr '.mat']); %and freq(w) and I have to transform them in
[compare(x)]=simuconf(coeffconfidsimple(x,:)'); %This function uses
%subdata and freq
%at each iteration
Doug Hull on 1 Nov 2013
Why use globals? They are often just confusing and hard to debug. Just pass them into simuconf.
More Answers (1)
Haithem Bouziri on 1 Nov 2013
I think you have to use matlabpool before using parfor , matlabpool(n) must call n workers to execute your parfor. n <= number of core in your processor.
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!