Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to plot in GUI data inserted by edit box?
Date: Mon, 28 Jul 2008 04:01:08 +0000 (UTC)
Organization: UFSC
Lines: 59
Message-ID: <g6jga4$kj$1@fred.mathworks.com>
References: <g6iksf$21p$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1217217668 659 172.30.248.37 (28 Jul 2008 04:01:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 28 Jul 2008 04:01:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1354092
Xref: news.mathworks.com comp.soft-sys.matlab:482151



"Andr? Zibetti" <shidao@gmail.com> wrote in message
<g6iksf$21p$1@fred.mathworks.com>...
> Hi guys,
> 
> Could you guys help me to figure out how can I plot (in GUI)
> some data points inserted in a edit box (or table) after
> confirm by pushing a button??
> 
> I wanna build a GUI that I can insert data point and confirm
> one by one and then this points be ploted in same GUI (axes).
> 
> thanks a lot in advance!!

Hi again, :)

I think that I already figure out my own question. Here is
the code:

in GUI callback, immediatly after %vargi... insert:
x=[0]
y=[0]
handles.x=x;
handles.y=y;

to create your vector and set them in handle structure

In GUI create the axes, two edit box, 2 static text box and
1 button.

In the callback button insert the code:
a = get(handles.edit1,'string')
set(handles.text1,'string',a)
X =str2double(a)

b = get(handles.edit2,'string')
set(handles.text4,'string',b)
Y =str2double(b)

handles.y(end+1) = Y
handles.x(end+1) = X

xmin = min(handles.x); ymin = min(handles.y);
xmax = max(handles.x); ymax = max(handles.y);
xx = xmin:0.1:xmax;
yy = spline(handles.x,handles.y,xx)
plot(handles.x,handles.y,'o',xx,yy)
guidata(hObject,handles)

done!!!

This is GUI that you can create your plot inserting values
right on edit box in GUI.


It's not a big deal, but's it my first time that I made
something in matlab GUI, so :))...

Thanks