How to set a constant parameter in an initialization file such that it is considered to be constant in an embedded matlab function?

3 views (last 30 days)
Hi,
My question may be naive but I'm not very proficient with Matlab Simulink.
I have an initialization file where I define all my constants and parameters before running my simulink simulation. Among these, I have a parameter, let's say N, that will stay constant during the whole simulation. On the other hand, in my simulation, I use a matlab function block in which one of my outputs is a vector of size N. Here comes the problem.
When I put N as an input of the function (either by entering it with a constant block as a normal input or by setting it as a parameter), the compiler gets angry because my vector is of "variable size", which it actually is not. When I set N as a global variable, the compiler doesn't find it and can't run the simulation.
So my question is: is there a way of defining once for all my variable N in my initialization file or should I define it locally in every embedded function that I use in my simulink file?
Thank you for your help,
Emmanuel

Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!