libstruct does not create the complete struct

1 回表示 (過去 30 日間)
Jannis Carstens
Jannis Carstens 2018 年 9 月 20 日
コメント済み: Philip Borghesani 2018 年 9 月 24 日
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

採用された回答

Philip Borghesani
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 件のコメント
Jannis Carstens
Jannis Carstens 2018 年 9 月 24 日
fieldnames showed all fields, regardless of any value assigned to any field. The inspector is definitely buggy!
Philip Borghesani
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 ExchangeWhos についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by