Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Doug’s Pick of the Week

May 7th, 2008

MATLAB Basics: Adding a table to a GUI

MATLAB GUI developers often want to have a mini-spreadsheet in their GUI. This can be done with a new widget added to the set of controls available in GUIDE. Now with UITABLE you can add that capability. This video shows how to add a table for display, then makes it editable and adds a callback such that MATLAB code is run whenever a cell in the table is edited. The data is not linked to the variables in the workspace, so this callback shows you how to pull data out of the table whenever it is updated.


Video Content

iconFiles.jpgiconPod.jpg

10 Responses to “MATLAB Basics: Adding a table to a GUI”

  1. Harold Figueroa replied on :

    So are these tables only numeric, or can we use a mixed type cell array to populate them?

    Also I am currently using 7.5 and see that these tables are available but undocumented. It seems like in this version the ‘data’ is a java object.

  2. Brett replied on :

    Doug, nice post. One thing, though: it occurs to me that you haven’t shown us how to use/share the value of the variable DATA (from the data in the table) outside of the workspace of the cellEditCallback workspace. There are several ways to do it–addressing the ways, and their relative merits, would make a nice follow-up blog!

  3. Ryan replied on :

    Brett, I agree. Given that the uitable is a new addition to MATLAB it would be great to see more discussion about various access methods.

  4. Doug replied on :

    Harold,

    UITable was undocumented, but available, for some releases in the past.

    Some features like this are available, but undocumented, for various reasons. Sometimes they are there so that we can use them in making tools for MATLAB. These features are undocumented because we need the flexibility to change the interface for a while. If you find undocumented features, you need to be aware that the interface can change or be removed in future releases.

    -Doug

  5. Malcolm Lidierth replied on :

    As far as access is concerned, the undocumented uitable of old provided cut and paste options from a uicontextmenu but the new version does not. Is that something that will be addressed in future releases?

  6. Doug replied on :

    Malcolm,

    This suggestion has been entered into our internal enhancement request database. Thanks for the suggestion.

    Doug

  7. Austin DeHart replied on :

    Hello Doug,

    I have a gui with a uitable that works well when you hit enter after each cell edit, but when you hit tab after editing a cell’s contents, the CellEditCallback is not executed. Is there a fix for this?

    Thanks,
    Austin DeHart

  8. Doug replied on :

    Austin,

    This is a known issue. I see that it has been fixed in the next release.

    Doug

  9. Keerthi Nagaraj replied on :

    Hey Doug,

    My question follows the previous post here. I am trying to edit the cells of a table. It works well if I hit tab after entering data. However, if I choose the contents of a cell by mouse-click-and-drag, and edit it, unless I click in another cell, the CellEditCallback is not called. I tend to edit the last cell, and then directly press a button that processes the data. So, I end up missing the data on the last cell I edit. How can I rectify this?

    By the way, I am sincerely grateful for the most educative and helpful posts. I even considered developing GUI, solely due to your videos.

    Thank you very much,
    Keerthi

  10. Doug replied on :

    Keerthi,

    Our developers are aware of that behavior. A change in behavior is likely in an upcoming release.

    Doug

Leave a Reply


Doug Hull is an Application Engineer at The MathWorks. A MATLAB user since 1994, he gets paid to live, eat, and breathe MATLAB! This blog is dedicated to promoting the File Exchange by highlighting files and original video content.



  • pierre: Hi sherryl and thank you for answering me, Actually, I already tried before to use this property because I...
  • Sherryl: In Response to Post #10 by Bryan - Hi Bryan, By default the analog input object will acquire one second...
  • Sherryl: Hello Pierre, Please look at the OutOfDataMode property. http://www.mathworks .com/access/helpd...
  • Scott Hirsch: Elya - In v7.0, try aviread. This has straightforward syntax for reading a single frame - you could...
  • Scott Hirsch: Eric - That’s a nice suggestion. I often get frustrated when debugging GUIDE guis and ending up...
  • pierre: Hi all, I have the Data Acquisition Toolbox, and I’m trying for 2 weeks to send a step voltage, and...
  • Eric S: It would be great to stop the debugger from coughing somewhere inside the more “internal̶ 1;...
  • Tareq: coef1 = rand(1,3)-0.5; coef2 = rand(1,3)-0.5; lex1=roots(polyder(c oef1)) lex2=roots(polyder(c oef2)) hold all...
  • Luca Balbi: While we’re at it… Checking for a number to be zero is tricky in itself. We’re better...
  • david: perhaps some error checking is in order. After all, it is possible that our randomly generated quadratic...

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

Related Topics