Converting a 2D Array into a 3D Array

11 Ansichten (letzte 30 Tage)
Curtis
Curtis am 11 Dez. 2017
Kommentiert: Curtis am 11 Dez. 2017
Hi, Hope someone can help, I have a 2D array of 1062 x 300 doubles in the format of Xn Yn Zn and I am trying to convert it into a 1062 x 100 x 3 matrix where each of the 3 dimensional points are collected together.
  2 Kommentare
James Tursa
James Tursa am 11 Dez. 2017
Bearbeitet: James Tursa am 11 Dez. 2017
How is the Xn, Yn, Zn stored in your 2D array? I.e., are X1, Y1, Z1 stored in your array(1,1:3), or are they stored in your array(1,1), array(1,101), array(1,201)? Or ...?
Curtis
Curtis am 11 Dez. 2017
they are stored as x1,y1,z1 are (1,1:3), and then x2,y2,z2, are entries 4, 5 and 6

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Stephen23
Stephen23 am 11 Dez. 2017
Perhaps:
reshape(M,[1062,100,3])
or
permute(reshape(M,[1062,3,100]),[1,3,2])
  1 Kommentar
Curtis
Curtis am 11 Dez. 2017
hmm, those don't seem to have the desired effect, to try to explain the issue, the best way I can describe the data is that it is 1062 frames of 100 3 dimensional points and i'm trying to break each frames 300 datapoints into 100 3 dimensional points

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by