Prev: uicalendar - ploblem with multiple date selections
Next: uicalendar - ploblem with multiple date selections
From: Adam on 31 May 2010 14:14 Hi, I have a GUI (made in GUIDE), which deploys another algorithm (.m file). This in a iterative algorithm and I would like to display information on the GUI after each iteration. Can i access the GUI from the .m? I've read how to share data among GUIs, but they seem be launching sub GUIs with a main/parent one. Is there an easy way to access a GUI from a non GUI. Thanks, Adam
From: Walter Roberson on 31 May 2010 14:28 Adam wrote: > I have a GUI (made in GUIDE), which deploys another algorithm (.m file). > This in a iterative algorithm and I would like to display information on > the GUI after each iteration. Can i access the GUI from the .m? I've > read how to share data among GUIs, but they seem be launching sub GUIs > with a main/parent > one. Is there an easy way to access a GUI from a non GUI. Matlab doesn't make any real distinction between what is GUI or not. If you have the figure number of the GUI (or the handle number of any object in the figure), you can use guidata() to retreive its handles or to store values for it.
From: Adam on 31 May 2010 14:32 Walter Roberson <roberson(a)hushmail.com> wrote in message <YcTMn.40645$wV2.17990(a)newsfe23.iad>... > Adam wrote: > > > I have a GUI (made in GUIDE), which deploys another algorithm (.m file). > > This in a iterative algorithm and I would like to display information on > > the GUI after each iteration. Can i access the GUI from the .m? I've > > read how to share data among GUIs, but they seem be launching sub GUIs > > with a main/parent > > one. Is there an easy way to access a GUI from a non GUI. > > > Matlab doesn't make any real distinction between what is GUI or not. > > If you have the figure number of the GUI (or the handle number of any > object in the figure), you can use guidata() to retreive its handles or > to store values for it. Thanks, after messing with this for a bit more I figured it out. Problem is when i call guidata(guiName) it opens a new instance of the gui instead of replacing what is in the currently open gui.
From: Walter Roberson on 31 May 2010 16:39 Adam wrote: > Thanks, after messing with this for a bit more I figured it out. Problem > is when i call guidata(guiName) it opens a new instance of the gui > instead of replacing what is in the currently open gui. guidata(guiName) is shorthand for guidata(guiName()) -- that is, call guiName, take the value returned by that procedure and pass it to guidata. guiName() will not result in the figure number of the existing figure unless you specifically code guiName.m to detect the situation and return the figure number. The figure number is an integer handle for the figure, allocated sequentially -- 1 for the first figure, 2 for the second figure, and so on, at each point allocating the lowest figure number that is not in current use. If your gui only creates a single figure, the figure number is very likely 1. There are various ways you can find the figure number if you do not wish to assume it to be a specific value. For example if you gave the gui figure a particular name, you could use findobj(0,'name',FigureName)
From: Adam on 31 May 2010 16:57
Walter Roberson <roberson(a)hushmail.com> wrote in message <hu16st$sim$1(a)canopus.cc.umanitoba.ca>... > Adam wrote: > > > Thanks, after messing with this for a bit more I figured it out. Problem > > is when i call guidata(guiName) it opens a new instance of the gui > > instead of replacing what is in the currently open gui. > > guidata(guiName) is shorthand for guidata(guiName()) -- that is, call guiName, > take the value returned by that procedure and pass it to guidata. guiName() > will not result in the figure number of the existing figure unless you > specifically code guiName.m to detect the situation and return the figure number. > > The figure number is an integer handle for the figure, allocated sequentially > -- 1 for the first figure, 2 for the second figure, and so on, at each point > allocating the lowest figure number that is not in current use. If your gui > only creates a single figure, the figure number is very likely 1. > > There are various ways you can find the figure number if you do not wish to > assume it to be a specific value. For example if you gave the gui figure a > particular name, you could use findobj(0,'name',FigureName) Thanks, my issue was with guide, the is named automatically so i couldn't 'figure' (pun) it out. I resolved the problem using gcfb though. Works well now, thanks. |