Doug’s MATLAB Video Tutorials

January 29th, 2009

Exploring uitable properties

I got a question via e-mail that was asking how to set the data in a uitable. Setting the data in a uitable is as easy as: >> a = uitable >> set(a,’data’, magic(3)) The important part of this video is seeing the thought process of discovering that. When you programmatically create a uicontrol, or uitable, you should capture the handle to that widget, as I did with a. When you have that handle you can GET or SET the properties of the widget.

Download the files here.

4 Responses to “Exploring uitable properties”

  1. Geoff replied on :

    Good to have you back here, Doug. As you know, the MATLAB GUI Building doc now links to your archive, so keeps these tips and tricks coming!

    Was this posting inspired by a user who had to ask how to get data into a uitable, even after checking the doc? If so, the MATLAB Graphics and GBT doc has utterly failed to communicate basic information.

  2. Andrew replied on :

    Is this supposed to perform the same on R2007a running on Mac OSX?

    This is what I get when I try to do the same things:

    
    EDU>> close all
    EDU>> clear all
    EDU>> a = uitable
    
    a =
    
    	javahandle_withcallbacks.com.mathworks.hg.peer.UitablePeer
    
    EDU>> set(a,'data',magic(3))
    ??? Object belongs to an incompatible Java class.
    
    EDU>>
    
  3. Andrew replied on :

    In case anyone else found the same issue…
    I went ahead and upgraded to R2008b (ver 7.7.0) and it works exactly as shown in the video. (Running on an Intel-Mac OSX)

    These video tutorials are really helpful! Thanks Doug!
    I am going to get a lot of use out of the uitable in the gui I’m writing.

  4. dhull replied on :

    Andrew,

    Glad you were able to solve your own issue and help everyone else out in the same way.

    Thanks,
    Doug

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.

Doug's picture

These postings are the author's and don't necessarily represent the opinions of The MathWorks.