Simulink block handles change

2 ビュー (過去 30 日間)
Alexander Boll
Alexander Boll 2021 年 7 月 14 日
回答済み: Alexander Boll 2021 年 7 月 15 日
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 Center および File ExchangeModeling についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by