Call an array by a string

3 visualizzazioni (ultimi 30 giorni)
aboudeh kahaleh
aboudeh kahaleh il 24 Ott 2016
Commentato: Guillaume il 24 Ott 2016
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 Commento
Guillaume
Guillaume il 24 Ott 2016
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.

Accedi per commentare.

Risposte (1)

KSSV
KSSV il 24 Ott 2016
k = [0,0,1] ;
cup1 = num2str(k) ;

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by