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

Bob Thompson
Bob Thompson 2019년 3월 8일
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
Paavo Auvinen 2019년 3월 10일
I guess I could combine the arrays, however, my aim is to be able to process the data fast and avoid extra steps. For technical reasons I get the data in separate files which results in several imported arrays. Trying to figure out the efficient way to this in MatLab as I'm eager to start using it over spreadsheet softwares.
Stephen23
Stephen23 2019년 3월 11일
편집: Stephen23 2019년 3월 11일
"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
Paavo Auvinen 2019년 3월 11일
Thank you for your insight, it was most helpful.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

질문:

2019년 3월 8일

댓글:

2019년 3월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by