필터 지우기
필터 지우기

Access and change variable in Model Workspace within the Simulink simulation

조회 수: 2 (최근 30일)
Luca FS
Luca FS 2021년 9월 22일
댓글: Luca FS 2021년 9월 23일
How can I change variables in the Simulink Model Workspace during simulation? So for example, I have a signal that is given from a subblock to the output. I want to store this signal continuously in a variable (a 1x1 double for example, no timeseries or so). I want to use the results as variable input e.g. for the frequency of a sine block (therefore the method with goto does not work here).

답변 (1개)

Jonas
Jonas 2021년 9월 23일
You cannot change objects in the Model Workspace during simulation. Or it's not intended for this at least.
Use Data Store Memory block to define a variable, and then Data Store Write at the subblock output and Data Store Read at the input of the sine block.
Instead of using a Data Store Memory block to define the data store object, you can also create a Simulink.Signal object inside your Model Workspace or Data Dictionary, it serves the same purpose. In the Data Store Write and Read blocks you will find back the Simulink.Signal object in the drop-down list.
  댓글 수: 2
Luca FS
Luca FS 2021년 9월 23일
편집: Luca FS 2021년 9월 23일
The Sine-Block I use doesn't have an input. I need to use the variable for the frequency. This isn't an input port...see picture (variable is f_el).
The sine block is just an example...I need it for other blocks as well
Luca FS
Luca FS 2021년 9월 23일
So I need a way the refer to the variable in the data store memory

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

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by