Simulink block handles change

2 visualizzazioni (ultimi 30 giorni)
Alexander Boll
Alexander Boll il 14 Lug 2021
Risposto: Alexander Boll il 15 Lug 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?

Risposta accettata

Alexander Boll
Alexander Boll il 15 Lug 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.

Più risposte (0)

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by