MATLAB command for "Rename all" into Model Workspace

조회 수: 2 (최근 30일)
Costantino Taglialatela
Costantino Taglialatela 2022년 10월 5일
댓글: Costantino Taglialatela 2022년 10월 12일
I would like to programmatically rename parameters into Model Workspace and their references inside the Simulink model.
Is there a way to do it by using a MATLAB command in a script? The "Rename all" option in the Model Workspace by right-clicking on a parameter would do the job, but I still have not found an equivalent command in MATLAB.

답변 (1개)

Animesh Gupta
Animesh Gupta 2022년 10월 11일
Hello,
It is my understanding that you want to programatically interact with variables inside Model Workspace.
Please refer the following documentation that explains the procedure - https://www.mathworks.com/help/simulink/ug/create-edit-and-manage-workspace-variables.html
I hope it helps.
  댓글 수: 1
Costantino Taglialatela
Costantino Taglialatela 2022년 10월 12일
Hello Animesh,
thanks for you reply. I had a look at the documentation but I did not find an equivalent MATLAB command to perform the "Rename all" action that you can manually do by right-clicking on the variable in the model workspace.
I tried to do this:
mdlWks = get_param('MyModel', 'ModelWorkspace')
var = mdlWks.getVariable('MyVar')
On the created Parameter object "var" I cannot see any method like "Rename all". I need to find a way to easily rename the parameter and all its occurrences into the model.
Thanks,
Costantino

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Naming Conventions에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by