How to migrate base workspace data to Model Workspace 如何将base worksapce的数据移植到model workspace中

6 vues (au cours des 30 derniers jours)
使用 Simulink.ModelWorkspace 对象与模型工作区进行交互。例如,您可以添加和删除变量、设置工作区的数据源以及将更改保存到工作区
Use the Simulink.ModelWorkspace object to interact with the model workspace. For example, you can add and delete variables, set the data source of the workspace, and save changes to the workspace
  1 commentaire
Xiaoning.Wang
Xiaoning.Wang le 4 Jan 2023
方法一:
open_system('vdp')
mdlWks = get_param('vdp','ModelWorkspace');
assignin(mdlWks,'myVar',5.12)
方法二:
temp = getVariable(mdlWks,'myVar');
temp = 7.22;
assignin(mdlWks,'myVar',temp)
附加信息:通过查询变量的值来确认新值。
getVariable(mdlWks,'myVar')
ans =
7.2200
大家可以查看help:
Simulink.ModelWorkspace
以编程方式与模型的模型工作区进行交互

Connectez-vous pour commenter.

Réponse acceptée

Xiaoning.Wang
Xiaoning.Wang le 5 Jan 2023
Mathework 官方回复:
web(fullfile(docroot, 'simulink/slref/simulink.modelworkspace.html'))

Plus de réponses (0)

Catégories

En savoir plus sur 管理设计数据 dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!