how can I array the external inputs for code generation in Simulink embedded coder?

ThingSpeak Community

This topic has been permanently closed and transferred to MATLAB Answers.

Jonas

how can I array the external inputs for code generation in Simulink embedded coder?

Jonas on 4 Mar 2025 at 14:36

I am building the c-code of a Subsystem in Simulink with the embedded coder. The created header file includes the following code-snippet which represents the 6 inports and 2 outports of the subsystem.
/* External inputs (root inport signals with default storage) */
typedef struct {
real_T V_dc_abs_B; /* '<Root>/V_dc_abs_B' */
real_T CM_B; /* '<Root>/CM_B' */
real_T GMEAS_A; /* '<Root>/GMEAS_A' */
} ExtU_Regelung_T;
/* External outputs (root outports fed by signals with default storage) */
typedef struct {
real_T AO_A; /* '<Root>/AO_A' */
real_T AO_B; /* '<Root>/AO_B' */
} ExtY_Regelung_T;
I also got an example code of a different simulink model which I'm following (I don't have the actual model, only the code). In their code, the external inputs and outputs code-snippet look like this:
/* External inputs (root inport signals with default storage) */
typedef struct {
real_T INPUTS[24]; /* '<Root>/INPUTS' */
} ExtU_WindExample_T;
/* External outputs (root outports fed by signals with default storage) */
typedef struct {
real_T OUTPUTS[21]; /* '<Root>/OUTPUTS' */
} ExtY_WindExample_T;
I would like to change my simulink model in a way that the embedded coder generates my external inputs and outputs the same way as in the example - as an array.
I have no idea which blocks to use for this problem and would much appreciate any help. I already tried to use bus creator and selector, but it didn't give me the desired result.

Comments have been disabled.

Go to top of page