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 件のコメント

per isakson
per isakson 2017 年 10 月 23 日
Which line is line 13?
Ina Hajdini
Ina Hajdini 2017 年 10 月 23 日
It's where the parfor begins.

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 23 日

0 投票

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 件のコメント

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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeParallel for-Loops (parfor) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by