I get an error, what's wrong?

parfor m = 1:blocks
for i = 1:nest
g(m,i,1) = normrnd(c(i),d(i))
a(m,i,2) = normrnd(g(m,i,1),d(i));
for n=2:draws;
a(m,i,n)=normrnd(a(m,i,n-1),d(i));
end
end
end
.
Error using parfor_exercise (line 13)
Error: The variable g in a parfor cannot be classified.

2 Commenti

per isakson
per isakson il 23 Ott 2017
Which line is line 13?
Ina Hajdini
Ina Hajdini il 23 Ott 2017
It's where the parfor begins.

Accedi per commentare.

 Risposta accettata

parfor m = 1:blocks
gm = zeros(1, nest);
for i = 1:nest
gm(1,i) = normrnd(c(i), d(i))
a(m,i,2) = normrnd(gm(1,i), d(i));
for n=2:draws;
a(m,i,n)=normrnd(a(m,i,n-1),d(i));
end
end
g(m, :, 1) = gm;
end

3 Commenti

Ina Hajdini
Ina Hajdini il 23 Ott 2017
It's giving me the following error:
Error: The variable a in a parfor cannot be classified.
g = zeros(blocks, nest, SomeSize);
a = zeros(blocks, nest, draws);
parfor m = 1:blocks
gm = zeros(1, nest);
am = zeros(1, nest, draws);
for i = 1:nest
gm(1,i) = normrnd( c(i), d(i) )
am(1, i, 2) = normrnd( gm(1,i), d(i) );
for n=2:draws;
am(1,i,n) = normrnd( am(1,i,n-1), d(i) );
end
end
g(m, :, 1) = gm;
a(m, :, :) = am;
end
Ina Hajdini
Ina Hajdini il 23 Ott 2017
This works. Thanks a lot!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by