Simulink block handles change

2 次查看(过去 30 天)
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?

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by