function boxes

%%This is a function prototype to get boxes to work so that I don't have to
%%go in and run the m-file every time I want to change something on a phase
%%plot

x=[1 2];
y=[1 1];

shg         %%Show Graph
clf reset   %%Reset all properties of graph
fig=gcf;
ax=gca;

set(fig,'doublebuffer','on','menubar','non',...       %... Can be used to extend lines! Yeh!
    'numbertitle','off','name','Box_Try',...
    'nextplot','add');

set(ax,'title',text('string',sprintf('My numbers= %4.0f %4.0f',y(1),y(2))),...
    'nextplot','add');


set(gcf,'userdata',0)
plot1=plot(x,y);

%%Button to generate plot with new value
Change_button=uicontrol('string','Go',...
    'units','normal',...
    'pos',[0.1 .02 .1 .06],...
    'callback','set(gcf,''userdata'',1)');

%%Slide bar to change value
Dot_value=uicontrol('style','slider',...
    'units','normal',...
    'position',[0.3 .02 .2 .06],...
    'min',0,'max',20);
                    
Stop=uicontrol('string','stop',...
    'units','normal',...
    'position',[.6 .02 .08 .06],...
    'callback','close(gcf)');

Dot_value_shown=uicontrol('style','edit',...
    'units','normal',...
    'position',[.1 .2 .08 .06],...
    'string',num2str(get(Dot_value,'value')));

Input=uicontrol('style','edit',...
    'units','normal',...
    'string','2',...
    'position',[.8 .02 .08 .06]);


while get(gcf,'userdata')==0
  
    pause(.25)
    
    if get(gcf,'userdata')==1
        y1=get(Dot_value,'value');
        y2=str2double(get(Input,'string'));
        y=[y1 y2];
        multiply_my_data(y1,y2);
        set(plot1,'xdata',x,'ydata',y);
        set(Dot_value_shown,'string',num2str(y1));
        title(sprintf('Your number=%4.3f',y1));
        set(gcf,'userdata',0);    
    end
    
end

function multiply_my_data(x,y)

    b=x*y;
    disp(b);

    
