I want to display the changes of the curves in the Simulink model in real-time in the APP designer.

2 views (last 30 days)
I want to display the changes of the curves in the Simulink model in real-time in the APP designer. In other words, I want to see the process of curve changes, but now I can only see the final result of the curve.
First,I display the result with codes below,but i want to show the process of changes real-time.
simInp = Simulink.SimulationInput('PC_Muti_Volume_platform_PB1_PB2');
simOut = sim(simInp);
load P_real.mat;
load P_set.mat;
plot(app.UIAxes_6,P_real.time,P_real.data,P_set.time,P_set.data);
The result is like this , how can I make it show the changes.

Answers (1)

Rahul
Rahul on 20 Mar 2025
As I understand you wish to demonstrate the output of your Simulink model in App Designer in real-time. You can consider using Simulink real-time components. MATLAB R2022a has som Simulink real-time components availble in the Component Library of App Designer. In order to use more Simulink real-time components, consider upgrading to recent MATLAB releases.
Refer to the following MathWorks documentations to know more about Simulink real-time components:
Another approach can be to use Simulink real-time App generator. This has capabilities to create an App Designer app, which would work with specified Simulink model and can be accessed from the Simulink editor from the Real-time tab.
Refer to the following documentations to know more about this:
The following MATLAB Answers mention another approach where the InitFcn and StartFcn of the Simulink model can be changed. A callback for updating the GUI of the app can be called.
Hope this helps! Thanks.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!