how to rename a variable?
古いコメントを表示
Hi,
I have a cell which contains twenty different names( Names<1x20 cell>),there is also twenty variables in my workspace like : VarName1 VarName2... I need to assign those names to these variables,the point is that I can not just overwrite them because I have values in variables and do not want to loss them.
any help would really appreciated.
採用された回答
その他の回答 (3 件)
Azzi Abdelmalek
2014 年 5 月 10 日
1 投票
Don't use several variables. Read this link http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
Star Strider
2014 年 5 月 10 日
1 投票
Navid
2014 年 5 月 10 日
0 投票
4 件のコメント
Star Strider
2014 年 5 月 10 日
What ‘doesn’t work’?
- What method are you using?
- What does it do that it shouldn’t
- What doesn’t it do that it should?
- Are you getting any errors?
Note that some of them, for example ‘ 'IST_HGH_RES_TRIP...' ’ are not valid variable names in MATLAB and will throw an error. It seems as though those names are truncated. You will at least have to get — and use — the entire variable name before any method will work.
Navid
2014 年 5 月 10 日
Image Analyst
2014 年 5 月 11 日
Star, you need to widen the columns to get rid of the ... and see the whole string.
Star Strider
2014 年 5 月 12 日
They were that way in the cell. I used char to see the entire string.
カテゴリ
ヘルプ センター および File Exchange で Variables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!