programmatically change simulink scope plot line visibility

조회 수: 5 (최근 30일)
Robyn Galliers
Robyn Galliers 2024년 5월 11일
편집: Pratyush Swain 2024년 5월 27일
Hello,
I have been searching all day for this on Google and on here. I found two old, existing questions asking for the same thing, with no joy. They are here:
What I would like to do is programmatically interact with the floating Simulink scope window from the Matlab command line, specifically to change the visibility of lines plotted on it. I am aware I can request the configuration of the Scope and interact with it to a degree (https://uk.mathworks.com/help/simulink/ug/control-scopes-programmatically.html), but that did not include any method to toggle line visibility. Anyone have any bright ideas please?

답변 (1개)

Pratyush Swain
Pratyush Swain 2024년 5월 23일
편집: Pratyush Swain 2024년 5월 27일
Hi Robyn,
I understand you want to change the visibility of lines plotted on scope block programmatically.I also could not find any documented resource to toggle the input lines on scope block. You can consider some workarounds for this issue as follows:
1- Conditional Signal Routing: Use Simulink's conditional signal routing blocks (such as Switch, Multiport Switch, or Manual Switch) to control which signals are fed into the scope. By controlling the routing block's condition programmatically, you can "turn off" certain signals.
Please refer to this demo example for reference:
% Access the control signal block for multiport and set its value
% (In this case we are selecting between 3 inputs so values can be 1-3)
set_param('multiport/Control Signal', 'Value', '2');
% Place name of simulink model file: I have kept it multiport
sym('multiport')
If you specifically want to toggle set of input lines as a group,you can consider controlling it by passing it through "enabled subsystems" block and controlling the "enable signal" programmatically.
2- Using Simulink Data Inspector Tool: The above approach still has some limitations placing conditions on all signals individually.If you do not want to make changes to your simulink model repeatedly and only toggling the lines programmatically is not a constraint, you can consider using simulink data inspector tool to log and visualize the signals, it offers a variety of options to visualize data by selecting signals and comparing different signal datas. For more information please refer to https://www.mathworks.com/help/simulink/slref/simulationdatainspector.html
Hope this offers some help.

카테고리

Help CenterFile Exchange에서 View and Analyze Simulation Results에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by