Assigning dynamic variable in wokspace?

조회 수: 3 (최근 30일)
nittin garg
nittin garg 2016년 10월 8일
답변: Walter Roberson 2016년 10월 8일
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!!!!

답변 (2개)

Walter Roberson
Walter Roberson 2016년 10월 8일

Pritesh Shah
Pritesh Shah 2016년 10월 8일
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 !!

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by