Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Problem indexing in parfor
3 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a program (an Ising model) which I must make it evolve until certain state, and then start to save the data in an array. But as im using parfor, I cant use the normal way of indexing. The code is something like this:
parfor T=1:nT
for i=1:tfinal
f=Function(f,parameters);
if i> (tfinal-tdat)
j=j+1 <--------------------------------Here is the problem
MdeT(T,j)=sum(sum(L));
EdeT(T,j)=E;
end
end
end
Thats how I want it to work, but I CANT use the "j" cumulative parameter inside the "MdeT", array in which I want to gather the information. How can I possibly do to save the information past a certain point, and not since the beginning, in a parfor?
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 11 月 7 日
You cannot.
However, you can save to cell arrays or structs with consistent indexing and with empty contents. Or you could,
MdeT(T, j - (tfinal - tdat)) = sum(sum(L));
EdeT(T, j - (tfinal - tdat)) = E;
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!