open .mat files and concatenate their matrix contents
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I will like to open many .mat files (sequentially named file_0.mat, file_1.mat,.....file_50.mat), and then concatenate (vertically and sequentially) the matrix data (about 2 million rows by 50 columns) into one variable available in the workspace accessible to other programs.
How can I write matlab codes to carry out this processes?
Thanks
James
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 29 Jun. 2012
4 Kommentare
James Tursa
am 29 Jun. 2012
IMO that is not a good way to do this in general. At every iteration in the loop you need to copy all of the data to a new memory block to do the concatenation. This drags performance. What I would do is read each iteration into an element of a cell array. Then after all of the files have been read concatenate all of the cell array contents into the big matrix. That way the data only gets copies once, not many times during the file reading iterations.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating 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!