Saman zahiri rad
Saman zahiri rad

Reputation: 13

Real time update of GUI Graph

I have made a simulink model and am running it through MATLAB GUI which contains a BLDC motor and a PI controller which controls its speed, now the problem is that the output apeed graph is updated when i stop the simulation i want it update it self in run time

% Update the string on the pushbutton
set(handles.Startstopbutton,'String','Start Simulation')

% Plot results from workspace after simulation
x = evalin('base','Scope(:,1)');
y = evalin('base','Scope(:,2)');
pHandles = plot(x,y,'Parent',handles.axesplot); 

thats my graph update function

Upvotes: 1

Views: 1597

Answers (1)

Phil Goddard
Phil Goddard

Reputation: 10772

There are several ways to have a MATLAB UI interact with a Simulink model as it is running, including

  1. using a custom S-Function to pass data to the UI at each time step

  2. using Event Listeners set up to listen for block (signals) as they change.

The Use MATLAB GUI's with Simulink Models blog discusses the approaches in more detail.

Upvotes: 1

Related Questions