How to save an array individually to avoid overwrite in a loop
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jung
am 4 Feb. 2016
Beantwortet: Walter Roberson
am 4 Feb. 2016
Hello,
So I managed to open sequence of files in Matlab using the following functions;
for k = 2010:2100
myfilename = sprintf('maxt_%d.pnt', k);
mydata = load(myfilename);
end
Here, because I don't save the array, the data gets overwritten and only show the last year data 'maxt_2100.pnt'. I tried mydata{k} within for loop but doesn't seem to work. Any idea how to save the data inside the loop individually so I can use them outside of the loop?
Thanks in advance
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 4 Feb. 2016
for k = 2010:2100
myfilename = sprintf('maxt_%d.pnt', k);
mydata{k-2010+1} = load(myfilename);
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!