Clear Filters
Clear Filters

I am currently trying to build a gui for one of the simulink model using matlab app designer.(plzz tell me how to use plot command for this)

13 views (last 30 days)
I am currently trying to build a gui for one of the simulink model using matlab app designer.It gives the output plot in the scope after around 100sec after the execution of the simulink model.I am not able to plot the live simulation plot on the matlab app designer.I have used sim command to simulate the simulink model and then used the plot command to plot the graph as shown below.
simout=sim('***.slx','StartTime',app.endTimeEditField.Value); %what changes do i need to make%
plot(app.UIAxes,simout.vlt.Time,simout.vlt.Data);
here vlt is the workspace used for the scope in the matlab simulink model. here the above two commands gives the output plot for the simulink model which gives the output graph instantaneously but it does not provide the graph for model which takes time to plot on the scope block(live simulation). Can you provide me a solution to this so that i can capture the live simulation result plot on the matlab app designer.I am a beginner and doing my 1st internship so plzz provide me a solution with explanation.Kindly reply to this question.
summary:-
plzz tell me who to make use of workspace block in matlab simulink to give the output plot in app designer for live simulation with proper explantion as i am a beginner. (it would be better if u can provide me with simulink model and app designer file for refrence)

Answers (1)

Sudil
Sudil on 11 Jul 2023
Hi Ayush,
From what I understand, you want to plot output for a live simulation. To do this, you'll have to read the output singals at regular intervals and update the plot accordingly.
This can be done using Simulink compiler in App designer. You can look at the following example which does exactly that: https://in.mathworks.com/help/slcompiler/ug/deploy-a-simulation-with-simulink-compiler.html . My suggestion would be to load the example in your MATLAB and try to understand the code. This example uses the compiler functions to get the simulation output regularly and updates the plots.
Hope this helps!

Categories

Find more on View and Analyze Simulation Results in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!