Assigning dynamic variable in wokspace?

3 Ansichten (letzte 30 Tage)
nittin garg
nittin garg am 8 Okt. 2016
Beantwortet: Walter Roberson am 8 Okt. 2016
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!!!!

Antworten (2)

Walter Roberson
Walter Roberson am 8 Okt. 2016

Pritesh Shah
Pritesh Shah am 8 Okt. 2016
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 !!

Kategorien

Mehr zu MATLAB 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