Structure Format - Writing a mat binary file using C#

I am not using any Matlab APIs. I have been able to create numeric arrays and save them as a Matlab binary file. I can write a simple structure and save it as a Matlab binary file. Where I am getting stuck is trying to figure out how to write a structure with a name that has more than 4 characters. Referring to page 32 in the Mat-File Format document the Array Name section has this in the Examaple Structure Mat File Data Element byte table
| 1 | miINT8 | X | padding|
I am guessing '1' represents the number of characters in the structure name
For example if my structure name is 'wooot' then I think it would look like this in the byte table
|0|5|0|1|w|o|o|o|
|t|0|0|0|0|0|0|0|
where 5 is the number of characters
1 is the miInt8 datatype
and the 7 zeros at the end are the padding
Any help would be greatly appreciated.

댓글 수: 2

Okay got it figured out the format is
|miInt8|# of characters|
so using 'wooot' it would look like
|0|0|0|1|0|0|0|5|
|w|o|o|o|t|0|0|0|
I think the structure name is limited to 4 characters if we are using the compressed format.
José-Luis
José-Luis 2017년 8월 22일
편집: José-Luis 2017년 8월 23일
Why are you reinventing the wheel? It's commendable, mind you, but generally error-prone. It's also probably my favorite sin.
That being said, what's wrong with using APIs? Saves time and they're hopefully better than anything you'd care to kludge.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Big Data Processing에 대해 자세히 알아보기

태그

질문:

2017년 8월 22일

편집:

2017년 8월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by