change name of variable completely in a loop
Ältere Kommentare anzeigen
I have a question.I wonder is there anyway in Matlab to change the name of variable to completely different thing in a for loop? Meaning that I would like name of first variable to be variable211, second variable is variable232 and third variable is variable345.
I am aware of something like:
for i=1:10
A(i)=i^2 % This creates A(1),A(2)......A(10)
I know I can use cell array but that one still gives something like array like A{1}, A{2}.I am looking completely different name like I explained above.
Antworten (1)
Azzi Abdelmalek
am 17 Aug. 2014
0 Stimmen
2 Kommentare
chess
am 17 Aug. 2014
Azzi Abdelmalek
am 17 Aug. 2014
Because the link explains how to create a variable, variable211
i=1
eval(sprintf('varaible%d=%d',211,i))
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!