Subsystem reference won't load properly into Simulink model
34 ビュー (過去 30 日間)
古いコメントを表示
Giovanni Gasperini
2023 年 3 月 22 日
回答済み: Giovanni Gasperini
2023 年 3 月 29 日
Hello,
I have project with the following structure:
- a folder containing a Simulink file "A",
- a folder containing a subfolder which hosts a masked subsystem file "B".
Simulink file "A" contains a subsytem reference to "B"; "B" has a model mask containing several non-tunable parameters. "A" has an init function which is automatically invoked before the start of every simulation, which is supposed to assign values to the parameters contained within "B" 's mask.
Everything works as it should if I open "B", then "A", then launch a simulation in "A". However if, instead, I select both folders and click "Add to Path -> Selected Folders and Subfolders", then open only "A", the subsystem doesn't seem to load properly. In particular, it seems to load without its mask. A warning also appears in the simulink diagnostics screen saying that the subsystem reference couldn't be updated because there are not enough input arguments, which I have no clue what it could possibly mean in this case.
All sorts of strange errors also tend to appear in the command window, sometimes saying that some Stateflow block couldn't be copied to the clipboard because it was corrupted. I'm not using Stateflow in this project at all, so again, no clue.
I hope this was clear enough, unfortunately I am pretty new to both subsystem references and subsystem masks in general, and I haven't been able to find anyone with a similar issue.
3 件のコメント
Mark McBroom
2023 年 3 月 25 日
You could try moving your code from an InitFcn callback to a PreLoadFcn callback. It could be that Simulink is trying to open the SubSystem reference before running the content of the InitFcn.
Other general suggestions on your M code. I would remove the clear all code and I would remove the code for setting path and replace with Simulink Projects for managing maths.
Thanks.
Mark.
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Model Editing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!