Borrar filtros
Borrar filtros

programmatically change simulink scope plot line visibility

6 visualizaciones (últimos 30 días)
Robyn Galliers
Robyn Galliers el 11 de Mayo de 2024
Editada: Pratyush Swain el 27 de Mayo de 2024
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?

Respuestas (1)

Pratyush Swain
Pratyush Swain el 23 de Mayo de 2024
Editada: Pratyush Swain el 27 de Mayo de 2024
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.

Categorías

Más información sobre Utilities en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by