Block Callback: How do I access block parameters in StartFcn?

3 views (last 30 days)
I have a virtual subsystem with a bunch of parameters. I would like to use those parameters to calculate other properties of the block. This needs to be done before the simulation starts, but AFTER the block has been initialized.
I tried to create a script that would use these parameters to calculate other variables, which would run from the StartFcn block callback. But, the script cannot access the parameters (which are input by the user through the mask) in the callback. I'm guessing this is because those parameters aren't available in the Matlab workspace.
Is there any way to access those parameters through StartFcn? Failing that, is there another way, instead of the StartFcn, through which I can perform some calculations BEFORE simulation starts?
To clarify, I cannot use the Initialization tab in the mask of the block because the script also requires data from other blocks, which are available in the workspace at the start of the simulation.

Answers (0)


Find more on View and Analyze Simulation Results 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!

Translated by