Convert text file data into a 3D matrix

I am trying to convert a text file of data into a 3 dimensional array but cannot figure out how to do this task. Each data set in the text file is separated by a blank line and an identification number. (I have attached the file)

回答(1 个)

dpb
dpb 2015-7-23
So I presume you intend the various subsets as the planes of the array?
There are groups of 6x7 floats followed by two lines (I presume it's not a display artifact?) of 7 and 6 if I counted correctly. What do you want to do with those; they won't fit into the same array unless it is a cell array. And, there's the timestamp on each first line of each set.
But, it's a pretty straightforward application of textread in a loop, adding each set into its array, reading first the timestamp, then the 2D array followed by the subsequent two lines (which I'd likely just store as a 2D array of 13xN).

类别

在 帮助中心 和 File Exchange 中查找有关 Cell Arrays 的更多信息

提问:

2015-7-23

回答:

dpb
2015-7-23

Community Treasure Hunt

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

Start Hunting!

Translated by