Assigning dynamic variable in wokspace?

i have made a dynamic variable by below command
eval(sprintf('new%d=[old_data]',old))
but not able to load the variable in workspace.Please help me this!!!!

Respuestas (2)

Pritesh Shah
Pritesh Shah el 8 de Oct. de 2016

0 votos

Make sure that old_data is defined before using this commend. Also, old should be 1*1 matrix size. Scale.
old=1;
old_data=1:10;
eval(sprintf('new%d=[old_data]',old));
This should work !!

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Oct. de 2016

Respondida:

el 8 de Oct. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by