MATLAB: How can i get a model argument from the modelworkspace into a matlab skript

encapsulationmodel argumentsreferenced modelsscriptsimulink

I want a script that calculates certain parameters from variables that I defined in the modelworkspace of a simulink model.
How do I access these variables?

Best Answer

  • wksp = get_param(mdl,'ModelWorkspace')
    value = wksp.getVariable('K')
    ... where "mdl" is your model's name :)
    - Sebastian