problem in using parralel computing toolbox
Show older comments
I want to speed up my computations using parfor. I am using the code written below,
l=31:1:1000; % length-scale
sig2=6.5:0.1:10; % noise-variance
sigf2=1.3:0.1:10; % signal-variance
L=zeros(length(l),length(sig2),length(sigf2));
par=zeros(length(l),length(sig2),length(sigf2));
lsig2=length(sig2);
lsigf2=length(sigf2);
% cross-validation
parfor i=1:length(l)
for j=1:lsig2
for k=1:lsigf2
par(i,j,k)=[l(i),sig2(j),sigf2(k)];
L(i,j,k)=kcrossval(Xtrain,ytrain,M,l(i),sig2(j),sigf2(k));
end
end
end
but it is not working. I get error:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts.
When I remove the code
par(i,j,k)=[l(i),sig2(j),sigf2(k)];
it works but gives the following warning:
the entire array or struct 'sig2' is a broadcast variable. This might result in unnecessary communication overhead.
I have read the documentation but not able to find a solution. Please suggest the solutions.
Accepted Answer
More Answers (0)
Categories
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!