2

I have a simulink model using matlab function blocks.

When i try to generate the C code from my model, the structures parameter scopes i used to represent my data are unused : When i say unused i mean, matlab coder creates a header file with all my structures defined. but in the actual algorithms, when the structure should be sent as argument to a function, matlab coder just defines new variables for each of the fields of which values are hardcoded.

So something like : Function(parameter); with parameter contraining X = 5 and Y = 8 becomes Function(5,8); once generated (so the function definition creating new variables for each of the fields).

You can imagine how messy that gets once the structures get too big.

A friend of mine told me objects dont work with matlab coder. So replacing my structs with objects is not an option unless my friend was wrong.

Does anyone know how i could force matlab coder to actually use the structures i defined for him? Or maybe there is another solution that i did not think of?

Thanks!

1 Answer 1

1

I have found the answer to my own question.

In the configuration file of the code generation, under "Optimization" tab, change "default parameter behaviour" from 'inlined' to 'tunable'.

I hope this will help others :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.