MATLAB: How to implement a custom datatype in Simulink model So, that the generated code is same as Union datatype in C.

code generationcustom datatypeEmbedded CoderMATLABmatlab codersimulinksimulink coder

The closest alternate will be Structure of structure using bus in Simulink.

Best Answer

As far as I know, Simulink never generates Union for any built-in data class.
For your requirement, you need to create your own data class and custom staorage class.
Check cscdesigner in your matlab help.