フィルターのクリア

Dynamics names in parfor loop

6 ビュー (過去 30 日間)
arnaud ensberg
arnaud ensberg 2016 年 4 月 13 日
コメント済み: Stephen23 2019 年 10 月 21 日
is it possible to creat a variables with dynamices names in parfor loop
i try this code
for i = 1:N
eval(['A' num2str(i) '= 5'])
end
but i obtain "transparency violation" error .

採用された回答

Walter Roberson
Walter Roberson 2016 年 4 月 13 日
No. All accezses must be obvious from the text of the code.
You can put the code into a function, as then MATLAB would know that the reference was local instead of possibly being to someone created before the loop.
Creating names using eval is not recommended and there are almost always better ways such as dynamic field names

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by