Search code examples
matlabsimulinkworkspace

Simulink - Store Variables inside a File


I know that typing r=1 in the MATLAB command line let the variable r available for an open Simulink Model.

For complex models i can just make an S-Function and type everything in there.

But for simpler models, I wouldn't wish to type any command, nor keep any .m script aside, just the .slx file alone, and still having a few variables r everywhere in the model, and available when I open it.

I dont remember if this is possible, how I could do that?


Solution

  • In the simulink model window choose File/Model properties/Model properties/Callbacks:

    model properties window

    Now r can be used in the model:

    model window