In Simulink, is it possible to send data to workspace in real-time using the 'ToWorkspace' block?
조회 수: 97 (최근 30일)
이전 댓글 표시
Hello everyone,
I have a large simulink model. In this model I calculate certain variables that are essentially [1x1] constants. For example, I analyze an electrocardiogram recording to count the number of heart cycles: num_cycles.
I would then like to use such constants like num_cycles in various other blocks like selectors and Matlab function blocks to fix the size of various variable size signals.
Now, if such constants would be defined in the workspace, I could just type num_cycles or whatever in the Simulink selector block, or in the output size of the Matlab Function's explorer. I have tried using the block "ToWorkspace" to do this. However, this block only sends data to workspace once the simulation in stopped or paused.
My question is: is there any way to send variables to the workspace immediately so that they can be accessed by future blocks as if they were workspace variables?
Thank you,
Rafael
댓글 수: 1
Paul
2020년 10월 25일
I don’t think you can do this. Please post here if you find a solution.
However, the answer may be in your question. Did you read the doc on “variable size signals”?
채택된 답변
추가 답변 (1개)
Ameer Hamza
2020년 10월 25일
댓글 수: 2
Ameer Hamza
2020년 10월 26일
I think that changing the parameters of a compiled model using values from the base workspace is not possible. You can read these values using extrensic(), but using them to changing the signal dimensions might require the re-compilation of the model.
참고 항목
카테고리
Help Center 및 File Exchange에서 Event Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!