Filter löschen
Filter löschen

Matlab Coder: doesn't support fields() function

3 Ansichten (letzte 30 Tage)
Alecsander Eitan
Alecsander Eitan am 23 Okt. 2022
Kommentiert: Denis Gurchenkov am 24 Okt. 2022
I have a large code which I need to convert to C using the Matlab Coder.
One issue that I face is that the fields() function is not supported. Since I handle structs comming from input files (*.xml) I need this Matlab function to be able to scan the variouse fields that are comming in.
I wonder if there is a solution or alternative function or code to replace this unsupported function.
Thank you,
  1 Kommentar
Denis Gurchenkov
Denis Gurchenkov am 24 Okt. 2022
Is fields(X) just a synonym for fieldnames(X)?
Can you give an example how you use this function?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 23 Okt. 2022
No there is not. You cannot create or use dynamic fields in generated code. C and C++ do not have dynamic structure field names.
You will need to parse the field names as text and record them and associated values as part of a data structure.

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by