How to use fread with sizeA involving 3D arrays?
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2023-5-2
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.
采纳的回答
Matt J
2023-5-2
One way:
Data = fread(fid, [rows,inf], 'uint32', 'l');
Data=reshape(Data,rows,cols,[]);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!