Get full path of referenced models

27 ビュー (過去 30 日間)
galaxy
galaxy 2021 年 5 月 25 日
回答済み: Fangjun Jiang 2021 年 5 月 25 日
Hi all,
I want to get full path of referenced models from simulink by matlab comment.
Example: Model/AAA_Reference (AAA)/Subsystem/abc_Reference (abc)
With AAA, abc are model reference.
I used find_mdlrefs, but match case does not true.
I used find_in_models, but it only give ModelName of Reference model.
So, Do any one know?, please help me.
Thank you so much

採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 5 月 25 日
ModelFile=get_param('ModelBlock','ModelFile');
File=which(ModelFile);
There is no full path info saved with the Model block, because it is not robust since someone else won't have the same folder/file structure.
which(ModelFile) could return empty. But if it is setup correctly, it should return the valid result since the referenced model should be in MATLAB path.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by