Operation on multiple arrays

조회 수: 5 (최근 30일)
Paavo Auvinen
Paavo Auvinen 2019년 3월 8일
댓글: Paavo Auvinen 2019년 3월 11일
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
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개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by