Clear Filters
Clear Filters

How to access table/compile-time data in Simulink models?

4 views (last 30 days)
The screen capture below is from the Motor included in the Fuel Cell / EV reference application. How do I access / view / modify the parameters shown here, such as "Mot.maxT"?
Thanks,
Mark

Answers (1)

Aditya
Aditya on 15 Dec 2023
Hi Mark,
I understand that you are looking to access and modify the parameters of the 'Motor & Drive (System Level)' block in your Simulink model, such as "Mot.maxT".
Here's how you can proceed:
  1. Check the Base Workspace: Open the MATLAB Command Window and use the command whos to list all variables in the base workspace. If "Mot" is a structure containing your parameters, it should appear in this list.
  2. Access Struct Variables: If "Mot" is indeed a structure, you can access its contents by typing Mot in the Command Window. To specifically see the "maxT" parameter, you can type Mot.maxT.
  3. Modify Parameters: If you find the parameter, you can modify it directly from the Command Window by typing Mot.maxT = newValue;, where newValue is the value you want to assign to the parameter.
  4. Save Changes: After modifying the parameter, you need to save the changes to the workspace. Use the command save if you want to save the workspace variables to a MAT file.
  5. Update Simulink Model: Go back to your Simulink model and update it to reflect the changes. This can be done by clicking the "Update Model" button in the Simulink toolbar.
If you do not find the "Mot" structure in the base workspace, it might be defined elsewhere, here’s how you can check it:
  • Search for Referenced Variables: Within the Simulink model environment, right-click on an empty area of the model background and select 'Find Referenced Variables'. This action will display a table listing all the variables along with their respective paths, which can guide you to the location of the "Mot" structure.
Hope this helps!
  1 Comment
Mark
Mark on 19 Dec 2023
Thanks. It took me a while to find it, but the "Variable Editor" gets me to where I need to be, I think. Thanks!

Sign in to comment.

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!