Clear Filters
Clear Filters

Parameter estimator not able to list some variables as parameter

4 views (last 30 days)
I have a simulink model which i am initialising using a matlab script (A). i have another script inside A which constructs a state space. Basically it has a variable which represents the state matrix and an input matrix which has some variables as elements. The parameter estimator tool is not able to list the variables inside those matrices since they are not model parameters. i tried to follow Matlab help which is this.
Before, i put these lines in the callback, i tried to run them in the command window and even before i declared them as mentioned in the help section separately like this.
i get this error.
>> Cp_cell_pack = evalin(wks,'Cp_cell_pack')
Unrecognized function or variable 'Cp_cell_pack'.
I also realise that these parameters which i am trying to estimate are invisible to the tool since they are not listed as model parameters. Evident here:
What am i missing? Please help.

Answers (1)

Akshat Dalal
Akshat Dalal on 11 Sep 2023
Hi Pranesh,
I understand you are facing an error while trying to estimate variables that are not model parameters.
You are facing this error because when you initialize your model using your MATLAB script ‘A’, the variables get stored in the ‘Base Workspace’ by default. However, in the MATLAB help code you are referring to, the variable ‘wks’ points to the ‘Model Workspace’, and thus expects your variables to be in the ‘Model Workspace’.
To load variables directly into ‘Model Workspace’ instead of ‘Base Workspace, open Model Explorer from the view menu and then choose ‘Model Workspace. You will see option to specify different ways for getting data on the rightmost pane. Select MATLAB File and choose your MATLAB script ‘A’ as the source.

Categories

Find more on Event 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!