Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: uitable help
Date: Wed, 2 Sep 2009 19:28:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 47
Message-ID: <h7mh04$2m7$1@fred.mathworks.com>
References: <h7l2qj$9qs$1@fred.mathworks.com> <h7lqrr$6b5$1@fred.mathworks.com> <h7mdhi$ftg$1@fred.mathworks.com> <h7mfur$mu7$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 1251919684 2759 172.30.248.37 (2 Sep 2009 19:28:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 2 Sep 2009 19:28:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1895050
Xref: news.mathworks.com comp.soft-sys.matlab:567943


"ben " <controlusc@gmail.com> wrote in message <h7mfur$mu7$1@fred.mathworks.com>...
> i also tried
> 
> set(handles.uitable2,'Data',magic(10))
> 
> 
> "ben " <controlusc@gmail.com> wrote in message <h7mdhi$ftg$1@fred.mathworks.com>...
> > I tried that but It didn't worked.
> > 
> > Tag name of the table is uitable2
> > 
> > when i give command as
> > set(uitable2,'Data',magic(10))
> > 
> > the error is "??? Undefined function or variable 'uitable2'."
> > 
> > Can you make an example please
> > 
> > 
> > 
> > "Andy " <theorigamist@gmail.com> wrote in message <h7lqrr$6b5$1@fred.mathworks.com>...
> > > "ben " <controlusc@gmail.com> wrote in message <h7l2qj$9qs$1@fred.mathworks.com>...
> > > > *I can add a table to my gui by this code:
> > > > mytable = uitable; 
> > > > set(mytable,'Data',magic(10))
> > > > set(mytable,'ColumnWidth',{25})
> > > > 
> > > > *Or i can add a table by dragging table icon from left frame in GUIDE Layout editor.
> > > > 
> > > > But when i add a table with Layout editor, i can't access to it from m file, because i don't know how to manipulate like
> > > > set(mytable,'Data',magic(10))
> > > > 
> > > > because i don't know the name of the table, it is not "mytable".
> > > > Can you help me please?
> > > 
> > > Drag the table into your figure, then right click on it and select "Property Inspector".  Change the "tag" field to whatever you want the table to be called.

Where are you putting this command?  I just created a GUI in GUIDE with a table, and set its CreateFcn to the following:

  function uitable1_CreateFcn(hObject, eventdata, handles)
  % hObject    handle to uitable1 (see GCBO)
  % eventdata  reserved - to be defined in a future version of MATLAB
  % handles    empty - handles not created until after all CreateFcns called
  set(hObject,'Data',magic(10));


This worked correctly for me.