Best way to call Simulink subsystem with various input parameters by skript

4 views (last 30 days)
Hello community, I have a large Simulink model and want to test a specific subsystem for different inputs by skript. The subsystem block has a lot of input ports (including BUS- signals) and one ouput port. I thought it would be possible to create a "s function" of this subsystem and call the function from a skript. But it seems s functions aren't made for calling from a skript.
Another way would be copy the block to another model and connect the input/output ports with "from/to workspace" blocks. Then calling the new model for each input combination with the "sim" command. I think this way would be time and work intensive.
Is there a better way to "Model In the Loop" subsystem blocks?
greetings

Answers (1)

Sebastian Castro
Sebastian Castro on 7 Jul 2015
If possible, you should convert that subsystem into a separate Simulink model. That lets you call the model by itself using the "sim" command, and its input/output ports can be set up in the "Data Import/Export" section of the configuration parameters.
Look at this page for examples of how to load MATLAB workspace data in as bus inputs:
- Sebastian

Community Treasure Hunt

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

Start Hunting!