필터 지우기
필터 지우기

Is it possible to use a parameter within the "To Workspace" block?

조회 수: 1 (최근 30일)
Simone Bergadano
Simone Bergadano 2024년 4월 8일
댓글: Fangjun Jiang 2024년 4월 10일
I have a "ToWorkspace" block inside a masked subsystem. I would like to change the name of the variable (where the data is saved) based on a parameter of the subsystem mask. Is it possible to do this somehow?
Thanks in advance for whoever helps me.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2024년 4월 9일
편집: Fangjun Jiang 2024년 4월 10일
I remember answering the same question before. The answer is "No" by value passing, but you could do it using set_param().
For MyValue=1, the value (1) of the variable name "MyValue" is passed into the mask workspace. Inside the masked subsystem where "MyValue" is used, it is using the value (1), not the name "MyValue".
But for "To Workspace" block, the variable name "name" itself is used, not the value of the variable name "name".
This sounds confusing but it is the case for a few similar parameters for other blocks.
If you are open to write some lines of code in the call-back of the mask, you could use set_param() to set the variable name of the To Workspace block, based on the name provided at the mask dialog.
What I would suggest is to use other signal logging methods, not to use "To Workspace" block. Basically, select the signal line, right click, select "Log Selected Signals".
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2024년 4월 10일
@Simone Bergadano, I updated the answer to include using set_param() as a way to implement what you want.

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

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by