Assigning dynamic variable in wokspace?

1 回表示 (過去 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 Center および File ExchangeWeather and Atmospheric Science についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by