|
On Sep 2, 12:10 pm, "ben " <control...@gmail.com> wrote:
> i also tried
>
> set(handles.uitable2,'Data',magic(10))
>
> "ben " <control...@gmail.com> wrote in message <h7mdhi$ft...@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 " <theorigam...@gmail.com> wrote in message <h7lqrr$6b...@fred.mathworks.com>...
> > > "ben " <control...@gmail.com> wrote in message <h7l2qj$9q...@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 trying this?
Did you remember to update the handles?
Normally, if you created (and saved) a uitable in GUIDE, assuming you
changed the tag to 'uitable2', you should be able to access the
information in this uitable through its handles properies:
set(handles.uitable2,'Data',magic(10));
For example, I have this code in a checkbox7 callback. My uitable's
tag is uitable1:
checkbox = get(handles.checkbox7,'Value');
if checkbox
set(handles.uitable1,'Data',rand(3,2)*10)
else
set(handles.uitable1,'Data',zeros(size(get
(handles.uitable1,'Data'))))
end
Are you saying that this still doesn't work?
If so: where are you putting this code?
Are you trying to run the GUI and then trying to set the data through
the matlab command prompt?
-Nathan
|