MATLAB Answers

How to update app's text field continously using Simulink with Stateflow.

3 views (last 30 days)
Damian Mikolajczak
Damian Mikolajczak on 17 May 2021
Answered: Pavan Guntha on 19 Aug 2021
Hi,
I'm currently working on a project and came across a problem. The project involves an app which has a lift keyboard with numbers from 1 to 9 and a text box which I want to show the current floor. Clicking a button changes an input constant in Simulink model which then goes into a Stateflow model. The Stateflow model simulates the lift moving across the floors and updates the output "floor" and displays it in a display block. I would like to make that floor number to continously update in the text box of the app. I've searched for a solution for a while now and none worked so I hope someone could help. Thank you!

Answers (1)

Pavan Guntha
Pavan Guntha on 19 Aug 2021
Hi Damian,
I understand that the issue is with establishing proper data transfer between MATLAB App, Stateflow & Simulink.
1) You could have a look at this page which clearly illustrates how we can pass data from App designer to Simulink.
2) You could make use of events in Stateflow for state transitions which can be integrated with Floor buttons in MATLAB App through callbacks. You can have a look at the example linked below which clearly illustrates the data transfer between MATLAB App and Stateflow.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!