Post by Jeffryset_param('modelname','simulationstatus','start');
I run into trouble when I need values being outputted to workspace to
be updated in the GUI displays. Do I need to change workspace
source
and destination for the simulink model?
In addition, values that run the simulink model need to be changed
interactively by user. How do I make the adequately link between
these two for proper execution?
Thanks for your time and consideration.
Jeffry
Hi Jeffry,
I've been trying to get answers to the exact same questions for the
GUI/model I'm creating. From the Mathworks support team I got the
following in regards to your second question:
To obtain a model's output without halting its simulation (in order
to adjust its subsequent inputs) please consider the following few
suggestions:
1. Use conditional/switch paths in your model, enabling it to control
its own behavior rather than controlling it externally from a GUI.
For example you could set up a conditional execution in your model
that switches to a different input upon satisfying a specified
condition. Most importantly now that it is a part of the model
itself, you no longer need to halt the simulation. To achieve these
constructs, try using the IF and SWITCH/CASE subsystems or the
MULTIPORT SWITCH block.
For additional information on using the IF block, type 'doc
simulink/if' at the MATLAB command prompt. For additional information
on using the SWITCH/CASE block, type 'doc simulink/switchcase' at the
MATLAB command prompt. For additional information on using the
MULTIPORT SWITCH block, type 'doc simulink/multiportswitch' at the
MATLAB command prompt.
2. Simulate the entire model in smaller pieces and perform the
conditions test to modify the inputs in between these simulations.
This can be achieved using the SIM or the MODEL functions as
mentioned in the following technical solution note :
<http://www.mathworks.com/support/tech-notes/1900/1903.html>
3. Also, please refer to the following technical solution that
provides an example of using a GUI to change Simulink parameters
during simulation:
<http://www.mathworks.com/support/solutions/data/1-1BDEE.html?solution=1-1BDEE>
If you need further assistance regarding this issue, please reply to
this email preserving the THREAD ID listed below. If you have a new
technical support question, please submit a new request here:
<http://www.mathworks.com/contact_TS.html>.
The example GUI from 3. uses
set_param('modelname','simulationcommand','update') to pass a changed
value from the GUI to the model during the simulation. Take a careful
look at their example code to see how they do it.
I am awaiting a reply on the first question from them and will try to
post to here when I get one.
HTH,
Andrea