Convert text file data into a 3D matrix
Mostrar comentarios más antiguos
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)
Respuestas (1)
dpb
el 23 de Jul. de 2015
0 votos
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).
Categorías
Más información sobre Cell Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!