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 .

 Respuesta aceptada

Walter Roberson
Walter Roberson el 13 de Abr. de 2016

2 votos

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

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 13 de Abr. de 2016

Comentada:

el 21 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by