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

6 次查看(过去 30 天)
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

回答(1 个)

Aditya
Aditya 2023-12-15
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 个评论
Mark
Mark 2023-12-19
Thanks. It took me a while to find it, but the "Variable Editor" gets me to where I need to be, I think. Thanks!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Model Editing 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by