File Exchange Pick of the Week

May 13th, 2008

Accessing data from one widget to another in GUIDE

Last time, I showed how to add the newly documented UITABLE to a GUI. [click here] There were a few questions [click here] about how to access the data in the UITABLE from the callback of another widget. The answer to this question is applicable to all widgets, not just UITABLES. Basically, you are using the handles structure to access the handle of another control, then using the GET command to query it for its data.

Video Content

iconFiles.jpgiconPod.jpg

3 Responses to “Accessing data from one widget to another in GUIDE”

  1. Eugene Sheynin replied on :

    Dear Doug Hull

    I was very impressed by your matlab videos.
    You are doing an excellent job!

    Cheers,
    Eugene Sheynin

  2. Loretta Reiss replied on :

    Can we access data from a widget in one GUI from another m-script (with its own GUI)?
    I have a set of m-scripts to maintain. There is a main script that puts up a figure (window) with widgets including buttons to invoke other processes. The other processes are implemented by either ordinary Matlab functions intended to be called with a fixed number of arguments listed in the first line or m-files that use nargin and varargin to determine how many arguments exist. For the functions with fixed number of arguments, I can pass the GUI figure handles from the main script and use get and set to access and change them in the function. Is this a reasonable thing to do?
    For the latter case–namely, in the functions that can have variable inputs–is there a way to access and change the data of the main function’s GUI?

  3. Doug replied on :

    Loretta,

    Can you access the data from one widget from another script? If you have the handle to the widget, you can use GET to find them. To get the handle, you would want to capture it and pass it to your other function, use FINDOBJ to find it, or in some other means make that handle avaiable. You may need to set the handleVisibility property of your GUI so that things work out.

    I do not understand your final question.

    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).


Bob, Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

  • oleg: The author has implemented skewness, kurtosis and checks answering appropriately to the critic.
  • Ashok: how to store 10 or more random number in a loop a loop for i = 1:n mean(i) = input(’enter the mean value...
  • Ben: Doug, Thanks for the very helpful videos! Uitables seem like a convenient way to make a customized property...
  • oleg: Allstats has no checks, no comments and could also be improved (talking about prctile implementatio). Not to...
  • Todd: Additional information and a link to download free MATLAB and Simulink LEGO MINDSTORMS NXT code can be found at...
  • Doug: @Leo, Here is the “English version” of that code. “vec = []” makes an empty variable...
  • leo: Dear Doug I have a question in your code ‘October 9th, 2009 at 13:53′ vec = []; vec = [vec val]; I...
  • Shanker Keshavdas: You sir, are a gentleman and a scholar… No really, helped me out a lot. As to what is...
  • Quan Zheng: how can I get a copy of stepspecs.m?
  • Doug: @Lucy I think this is what you seek to move a line with the mouse in MATLAB. http://blogs.math...

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