function varargout = updategui(varargin)

%create a run time object that can return the value of the gain block's
%output and then put the value in a string

persistent guiplot

Scope = get_param('DTS/Scope','RuntimeObject');

% create str from rto1
h1 = num2str(Scope.InputPort(3).Data);

% get a handle to the GUI's 'current state' window
display = findobj('Tag','edit_display');

% update the gui
set(display,'string',h1);

% Save Data to workspace
XData = get_param('DTS','SimulationTime');
YData = Scope.InputPort(3).Data;

assignin('base','XData',XData)
assignin('base','YData',YData)

if isempty(guiplot) || ~ishandle(guiplot)
    guiplot=findobj(0, 'Tag','axes1');
end

plot(guiplot,XData,YData);