Call GUI function from another GUI

  • Follow


Hello!
I have 2 GUI, big Main with set of functions and small showdata, which is opened by button in the Main. I use handles of main GUI, as arguments

showdata('main', handles.Main);

So I have access to handles of main GUI, but I also want to use function of main GUI, e.g. I have function in the Main GUI

function slice=GetSlice(hslider)
slice=ceil(get(hslider,'Value'));

I'm trying to call it from showdata GUI
handles.Image = varargin{2};
mainImage=guidata(handles.Image);
zslice=GetSlice(mainImage.ZSlider);

And I have error
??? Undefined function or method 'GetSlice' for input
arguments of type 'double'.

How can I call this function?

Thanks
0
Reply Elena 9/8/2010 9:24:20 PM

"Elena " <e.e.belova@gmail.com> wrote in message <i68uu4$6g$1@fred.mathworks.com>...
> Hello!
> I have 2 GUI, big Main with set of functions and small showdata, which is opened by button in the Main. I use handles of main GUI, as arguments
> 
> showdata('main', handles.Main);
> 
> So I have access to handles of main GUI, but I also want to use function of main GUI, e.g. I have function in the Main GUI
> 
> function slice=GetSlice(hslider)
> slice=ceil(get(hslider,'Value'));
> 
> I'm trying to call it from showdata GUI
> handles.Image = varargin{2};
> mainImage=guidata(handles.Image);
> zslice=GetSlice(mainImage.ZSlider);
> 
> And I have error
> ??? Undefined function or method 'GetSlice' for input
> arguments of type 'double'.
> 
> How can I call this function?
> 
> Thanks

First: Don't name your variable 'slice' as this is a MATLAB stock function.
Second: Rewrite GetSlice where you're calling it from and use setappdata/getappdata to pass the handles between the GUIs.
0
Reply Sean 9/8/2010 9:55:20 PM


1 Replies
476 Views

(page loaded in 0.229 seconds)

Similiar Articles:













7/22/2012 5:25:13 PM


Reply: