Matlab Coder: doesn't support fields() function

조회 수: 5 (최근 30일)
Alecsander Eitan
Alecsander Eitan 2022년 10월 23일
댓글: Denis Gurchenkov 2022년 10월 24일
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
Denis Gurchenkov
Denis Gurchenkov 2022년 10월 24일
Is fields(X) just a synonym for fieldnames(X)?
Can you give an example how you use this function?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2022년 10월 23일
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.

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by