Dynamics names in parfor loop

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by