function varargout = update_gui(varargin) persistent plot_handle plot_handle1 %create a run time object that can return the value of the outport block's %input and then put the value in a string rto1 = get_param('Beispiel4_sim/simout','RuntimeObject'); % create str from rto1 str = num2str(rto1.InputPort(1).Data); % get a handle to the GUI's 'edit_display' window display = findobj('Tag','edit_display'); % update the gui set(display,'string',str); % get Data from Simulation XData = get_param('Beispiel4_sim','SimulationTime'); YData = rto1.InputPort(1).Data; % save Data to workspace assignin('base','XData',XData) assignin('base','YData',YData) % real-time plot if isempty(plot_handle) || ~ishandle(plot_handle) guiplot=findobj(0, 'Tag','axesplot'); plot_handle = plot(guiplot, XData, YData); else XData_old = get(plot_handle, 'XData'); YData_old = get(plot_handle, 'YData'); XData = [XData_old, XData]; YData = [YData_old, YData]; set(plot_handle, 'XData', XData) set(plot_handle, 'YData', YData) %axis([0 20 0 10]) drawnow end