Borrar filtros
Borrar filtros

Querying if a model contains a block with a value

1 visualización (últimos 30 días)
Paul
Paul el 5 de Jun. de 2014
Respondida: A Jenkins el 5 de Jun. de 2014
Hi I'm adapting some code for error checking of blocks in my model.
I would like to know if a block exists inside my model with a certain path and a variable.
e.g
Blockpath='Subsystem/Subsubsytem/Constant' Variable='Value'
What is the quickest way to do this as i would be wanting to do it several times?
Regards
Paul

Respuesta aceptada

A Jenkins
A Jenkins el 5 de Jun. de 2014
It depends on the block type, but for a constant block the quick answer is
get_param('Model_Name/Subsystem/Subsubsytem/Constant','Value')
If you aren't sure of the full path, click on the block in simulink, then type gcb in MATLAB. If you want even more capability to search path names and values, look at find_system()
doc find_system

Más respuestas (0)

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by