Simulink block handles change

2 visualizaciones (últimos 30 días)
Alexander Boll
Alexander Boll el 14 de Jul. de 2021
Respondida: Alexander Boll el 15 de Jul. de 2021
I am analyzing Simulink models programmatically. For this I need to give every block an ID. I thought about using a block's handle for this -- e.g. the handle "2.000122070312500" for the block "data_in". My problem is, that these handles actually change each time a model is loaded with "load_system", destroying my IDs. After a clean Matlab restart, the handles are restored again, indicating there is some cache for handles.
Is there a way to clear the handle cache, so that handles will be reset and usable as IDs?
Is there another system to give each block an ID or should I just write my own?

Respuesta aceptada

Alexander Boll
Alexander Boll el 15 de Jul. de 2021
I found out, that a block's property 'Name' cannot be duplicated in the same subsystem. This means, that unique IDs can be given by using all the parent subsystems of a block plus it's name. As subsystems are also just blocks, this means, the parent hierarchy is duplicate free, as well.
E.g. the blocks called "Add1", "Add2" and "Clock" in the subsystems "Main/Precomputation" may be given the unique IDs "Main/Precomputation/Add1", "Main/Precomputation/Add2", "Main/Precomputation/Clock".
I did not yet find a way to clear the handle cache, but this way, I don't need to.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by