C Union data type in Matlab/Simulink

31 vues (au cours des 30 derniers jours)
vamshi krishna kammadanam
vamshi krishna kammadanam le 13 Avr 2022
Hi all,
I am trying to port embedded hardware driver files written in C to Simulink using C Caller.
I am able to port it except the Union datatype. Matlab does not recognise this data type.
Has anyone been able to solve this?
The final aim is to use embedded coder to generate C code to run the hardware.

Réponses (2)

Mark McBroom
Mark McBroom le 16 Avr 2022
You are correct that Simulink does not support unions. If you plan to use only one of the union-ed fields in your Simulink model, you can temporarily replace the union-ed field with the actual field you will use in Simulink. After genratig code, you can switch back to the original header file that contains the union.
THanks.
Mark.

Muthukumar Ganesan
Muthukumar Ganesan le 20 Août 2022
Hi,
One of the workaround is here.
Thanks

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by