Casting a byte array to a struct
14 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have a data file logged in binary. I would like to read this data into Matlab to plot and perform analysis.
My question is: Can one directly define a struct in Matlab and then cast a array of binary data to it? This is easily achieved in C, but I cannot find an equivalent means in Matlab.
The alternative is ofcourse to pack each field in the struct individually, but the problem with this is that there are several structs within the data, each with 20+ fields!
Thanks in advance,
Amir
0 件のコメント
回答 (1 件)
Walter Roberson
2013 年 3 月 22 日
No, MATLAB struct fields each have separate data areas.
2 件のコメント
Reine Gill
2022 年 6 月 14 日
I have the same problem and data comes from a tcpclient so I can not use memmapfile. Is there an easy way ?
Walter Roberson
2022 年 6 月 14 日
There is no easy way.
https://undocumentedmatlab.com/articles/serializing-deserializing-matlab-data
or look in the file exchange with keyword "serialize"
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!