Access pointer to struct in Matlab Coder
古いコメントを表示
Hello,
I have a c header file with the following struct and inline function to access the pointer to the struct:
typedef struct {
float field1;
unsigned field2;
} myStruct;
extern myStruct data;
inline myStruct* access_structData (void) {
return &data;
}
I tried to access the pointer to the struct with coder.opaque:
structPtr = coder.opaque('myStruct *','NULL','HeaderFile','struct_header.h')
structPtr = coder.ceval('access_structData')
a = structPtr.field1;
I cannot generate code for this since "??? Attempt to extract field 'field1' from 'coder.opaque'". How can I read and write data to a struct using a pointer? Is there any proper work-arounds?
In c the code for what I try to do would look something like this:
float a = access_structData->field1;
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Algorithm Design Basics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!