Operation on multiple arrays
Ältere Kommentare anzeigen
I am struggling with a following problem. I have large amounts of experimental data. I import the time stamps as one column arrays in datetime format.
Let's call these arrays A,B,C... Now, for plotting I want to change the format to 'mm:ss', so I write A.Format='mm:ss'
Is there a convinient way to perform this Format operation (and similar operations) on several arrays at once or is For-loop and proper naming the only option?
I tried something like (A,B,C,D...).Format='mm:ss' but obviously without results.
Thank you for your help!
4 Kommentare
Bob Thompson
am 8 Mär. 2019
Do you need to load all of your data into separate arrays, or can you put them all into one multidimensional array? If you can load them into one array, then you can apply A.Format = mm.ss to the entire array.
Paavo Auvinen
am 10 Mär. 2019
"I guess I could combine the arrays, however, my aim is to be able to process the data fast and avoid extra steps."
Importing your file data into one array is the fast way to solve this quickly and to avoid extra steps. Importing file data into one array is exactly what the MATLAB documentation shows:
"For technical reasons I get the data in separate files which results in several imported arrays."
The separate arrays should be combined into one numeric array, or stored in one container array (e.g. a cell array, as the MATLAB documentation shows), when you import the data.
"Trying to figure out the efficient way to this in MatLab as I'm eager to start using it over spreadsheet softwares."
The efficient way to do this is to import your data into one array, which you can trivially access using neat, simple, and very efficient indexing. In contrast, the approach you are trying forces you to write slow, complex, buggy, hard-to-debug code. Read this to know some of the reasons why:
Paavo Auvinen
am 11 Mär. 2019
Antworten (0)
Kategorien
Mehr zu Low-Level File I/O 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!