How to use fread with sizeA involving 3D arrays?

11 Ansichten (letzte 30 Tage)
Wei Yow
Wei Yow am 2 Mai 2023
Beantwortet: Matt J am 2 Mai 2023
When using fread, the size of the array is default for a two element row vector. What should i include if I need to read from a 3D array? [ row, col, frame]?
Data = fread(fid, [rows,cols], 'uint32', 'l');
Thanks in advance
  1 Kommentar
dpb
dpb am 2 Mai 2023
Just read the array as vector and then reshape to the output size -- presuming was written in column-major order.
You'll have to know the order in which was written.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 2 Mai 2023
One way:
Data = fread(fid, [rows,inf], 'uint32', 'l');
Data=reshape(Data,rows,cols,[]);

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays 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