Subsystem reference won't load properly into Simulink model
33 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Giovanni Gasperini
el 22 de Mzo. de 2023
Respondida: Giovanni Gasperini
el 29 de Mzo. de 2023
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 comentarios
Mark McBroom
el 25 de Mzo. de 2023
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.
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Interactive Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!