Convert text file data into a 3D matrix
Show older comments
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)
Answers (1)
dpb
on 23 Jul 2015
0 votes
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).
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!