Simulink.findBlocks error The first input must be a system name or handle.
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Greetings,
Setup: create a model with a constant block in it.
Select the constant block
Type the following command:
Simulink.findBlocks(gcbh,'BlockType','Constant')
and get the error
Error using Simulink.findBlocks
The first input must be a system name or handle.
Caused by:
Error using Simulink.findBlocks
The first input is an object of type 'Constant block'.
This seems to apply to all native (unmasked) simulink library blocks which normally wouldn't be a problem but I have a masked block ('Mask' is 'On' but there is no masked subsystem, just some custom parameters) which returns the same error. Is there a particular parameter I can examine to sort this out?
Setting aside the inconsistent behavior of this function to emphasize my question, is there a block parameter that I can use to differentiate between a masked block with no subsystem and a masked block with a subsystem?
Thanks
-Chris
2 comentarios
Les Beckham
el 11 de Ag. de 2023
I don't understand why you are trying to "find" the current block (gcbh is a handle to the currently selected block).
Simulink.findBlocks is for searching in a model (system) to find blocks of a specified type. The error message is pretty clear about this.
What are you really trying to do?
Respuestas (1)
C B
el 12 de Ag. de 2023
As it shows
Error using Simulink.findBlocks
The first input must be a system (name or handle).
So it is basically asking for system name or handle which should be model name or subsystem.
To solve this instead of selecting constant block.
Select the SubSystem
And Enter your command
Simulink.findBlocks(gcbh,'BlockType','Constant')
Please let me know if this is not what you want.
Ver también
Categorías
Más información sobre Subsystems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!