Define an array with variable
Ältere Kommentare anzeigen
Hello, I wonder how can I define an array with a variable, for example,
x_i=an array, where i changes. I do not think Matlab allows such operations. How can I accommodate it? Later on I will use x_i in loops.
Thanks.
Akzeptierte Antwort
Weitere Antworten (1)
Azzi Abdelmalek
am 29 Apr. 2013
k=4
assignin('base',sprintf('x_%d',k),[1 2 3])
1 Kommentar
C Zeng
am 29 Apr. 2013
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!