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 Kommentare

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

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Okt. 2017

0 Stimmen

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 Kommentare

Ina Hajdini
Ina Hajdini am 23 Okt. 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 am 23 Okt. 2017
This works. Thanks a lot!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by