Plotting Data from Simulink in GUI while Simulation is runnning
1 view (last 30 days)
Show older comments
I am trying to plot a Graph in my GUI (generated with Guide) with .mat data i generate with "to File"-Blocks in Simulink. I want to to this because
i want to realtime see the Graph beeing changed in the GUI.
My idea is to write the plotting in an extra function with a for-slope and call it from the start_button of the GUI. I thought this way my simulation can go on while i still can plot the data to my GUI.
The code is obviously wrong in the way i use the function i think. I have just started using matlab and dont know how to do the realtime plotting.
% --- Executes on button press in startbutton.
function startbutton_Callback(hObject, eventdata, handles)
a=get_param('epruf_gui','SimulationStatus');
set(handles.statusbox,'String',a);
a=get(handles.v_max1,'String');
b="0";
x=get(handles.v_max1,'String');
z=get(handles.i_max_last,'String');
if isempty(x)|| isempty (z)
str = sprintf('%s\n%s\n%s',...
'Füllen Sie bitte die leeren Felder');
hedlg = errordlg(str,'Fehlende Werte','modal');
uiwait(hedlg);
else
set_param('epruf_gui/motorctrl/v_max','Value',a);
set_param(['epruf_gui/stopinput'],'Value',b);
set(handles.startbutton,'visible','off');
set(handles.waitbutton,'visible','on','enable','off');
set_param('epruf_gui',"SimulationCommand","Start");
set(handles.waitbutton,'visible','off','enable','off');
set(handles.stopbutton,'visible','on');
end
% Function to Plot the data in the GUI (link to gui still missing)
function printplot()
x=1;
y=1;
for x=1:50
load('m_data');
mvalue=ans(2,x);
load('rpm_data');
rpmvalue=ans(2,x);
mvalue
rpmvalue
end
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!