이 제출물을 팔로우합니다
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다
This function reads a structure from a C header file and convert it to Matlab structure.
[MatlabStruct] = Read_C_Struct_From_header(h_FileName);
[MatlabStruct] = Read_C_Struct_From_header(h_FileName, OutStructName);
h_FileName - The name of the h file (e.g. LogStruct.h)
OutStructName - The name of the structure that will be extructed from the header file. If the name doesn't exist in the file or wasn't input by the user, the last structure in the file will be output
The function also supports nested structures.
The struct can be defined by either 'typedef' or 'struct', but doesn't support mix definitions.
for example:
typedef struct {
unsigned long long Var1;
char Var2;
float Var3[8];
} my_struct;
Or:
struct my_struct {
unsigned long long Var1;
char Var2;
float Var3[8];
};
The function is currently limit to the following data types:
[double, single, int8, uint8, int16, uint16, int32, uint32, int64, uint64]
['char', 'short', 'long', 'int', 'long long', 'float', 'double', 'unsigned char', 'unsigned short', 'unsigned long', 'unsigned int', 'unsigned long long']
--------------------------
This function is very useful when trying o read a binary file that was created by C\C++ code. It can be used to to create a structue for the 'cstruct' function:
AJ Johnson (2020). cstruct (https://www.mathworks.com/matlabcentral/fileexchange/4048-cstruct), MATLAB Central File Exchange. Retrieved April 26, 2020.
인용 양식
Lior Alpert (2026). Read Structure From C header file (https://kr.mathworks.com/matlabcentral/fileexchange/75210-read-structure-from-c-header-file), MATLAB Central File Exchange. 검색 날짜: .
