Interaction between Matlab Workspace and Simulink/Stateflow

1 view (last 30 days)
Hi,
I'm trying to grasp the concept of communication between different parts of the Matlab environment.
I've started by constructing a very basic function in Stateflow (a two state on/off toggle) with a single input (either 0 or 1, off or on). So far so good, I provide the stimuli through a simple switch connected to two constant blocks (0 and 1).
Now, instead I want to create a GUI with two push buttons replacing the switch.
How do I provide input from the GUI to the Simulink environment in such a way that when I push the 0 button the toggle turns off and when I push the 1 button it turns on? In the future I intend to create a GUI used for simulating an embedded system but right now I want to understand what was are available.
Creating a simple variable (for intance indata1=0;) and toggeling this in a GUI updating the workspace variable with either 0 or 1 did not work when running the simulation (indata1 assigned to a constant block in simulink). The simulation only seemed to read the value at the start of the simulation, changing the workspace variable through the GUI did not pass it on to Simulink.
I hope my question is clear.
Thanks

Answers (0)

Categories

Find more on Simulation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!