Call an array by a string

Hello,
in my code i need to call the array [0,0,1] by the string 'cup1' how can i do that?
Thank you so much!!

1 件のコメント

Guillaume
Guillaume 2016 年 10 月 24 日
It's not very clear what you're trying to do, particularly the motivation. I assume you're not asking for
cup1 = [0, 0, 1];
Hopefully, you're not asking how to name your variable dynamically as it's a very bad idea. Again, explain what you want to do and more importantly why.

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2016 年 10 月 24 日

0 投票

k = [0,0,1] ;
cup1 = num2str(k) ;

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

質問済み:

2016 年 10 月 24 日

コメント済み:

2016 年 10 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by