Filter löschen
Filter löschen

Dynamics names in parfor loop

6 Ansichten (letzte 30 Tage)
arnaud ensberg
arnaud ensberg am 13 Apr. 2016
Kommentiert: Stephen23 am 21 Okt. 2019
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 .

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 13 Apr. 2016
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

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by