libstruct does not create the complete struct
2 次查看(过去 30 天)
显示 更早的评论
in the c-header file of the DLL, a struct is defined:
typedef struct FrameMetadata
{
unsigned short Size; // size of this structure
unsigned int Counter; // frame counter
unsigned int CounterHW; // frame counter hardware
long long Timestamp; // time stamp in UNITS (10000000 per second)
long long TimestampMedia;
TFlagState FlagState;
float TempChip;
float TempFlag;
float TempBox;
WORD PIFin[2];
// DI = PIFin[0] & 0x8000
// AI1 = PIFin[0] & 0x03FF
// AI2 = PIFin[1] & 0x03FF
}FrameMetadata;
now I want to create an instance of the struture using
myStruct = libstruct( 'FrameMetadata');
myStruct is created, but in the inspector, the struct lib.FrameMetadata has only for entries:
- FlagState
- TempChip
- TempFlag
- TempBox
Why does MATLAB skip all the other entries? When the DLL is loaded with it's c-header, no warnings or errors are shwon. In the inspector it is also possible to chose from the values of the TFlagState for the FlagState entry.
Regards, Jannis
0 个评论
采纳的回答
Philip Borghesani
2018-9-21
It appears that there is a bug in the inspector. It does not seem to show all fields of a libstruct. Try accessing the fields that don't appear to you in the inspector or use the fieldnames(myStruct) or get(myStruct) to see the different fields.
Remember that until data is assigned to at least one field of a libstruct it remains in an uninitialized (null) state and some fields may not act the way you expect them too.
I will report this bug but suggest you contact support for any updates or additional help.
2 个评论
Philip Borghesani
2018-9-24
Long and unsigned long data types confuse the inspector. These types exist only for loadlibrary support and change size depending on the platform and 64/32 bit version of MATLAB.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!