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 comentarios

per isakson
per isakson el 23 de Oct. de 2017
Which line is line 13?
Ina Hajdini
Ina Hajdini el 23 de Oct. de 2017
It's where the parfor begins.

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Oct. de 2017

0 votos

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 comentarios

Ina Hajdini
Ina Hajdini el 23 de Oct. de 2017
It's giving me the following error:
Error: The variable a in a parfor cannot be classified.
Walter Roberson
Walter Roberson el 23 de Oct. de 2017
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 el 23 de Oct. de 2017
This works. Thanks a lot!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 23 de Oct. de 2017

Comentada:

el 23 de Oct. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by