From: Jason Gaul on 16 Jul 2010 05:50 I am currently working on a program that processes data through a series of GUI's that require data to be shared among many of the GUI's. I am trying to share one piece of data from the main GUI with the tag "File_Info" with a GUI which gives the user options for plotting a set of data. I am trying to use the UserData property and getappdata()/setappdata(), the problem is that when I try to use the handle of the main GUI, the plotting GUI has no idea that the information exists and as a result gives the error: ??? Undefined function or variable 'File_Input'. etc. I have been trying to use guidata() to transfer the GUI data from the main GUI to the secondary one but despite many attempts I have been unsuccessful. This is my latest attempt: %Section of code from the 'File_Info' GUI in the callback function that gets pyronum, %my desired data Pyronum=get(handles.pyronum, 'Value') set(handles.pyronum,'UserData',Pyronum); %Just trying both methods here setappdata(handles.File_Info,'pnum',Pyronum) guidata(hObject,handles); %Section of code from the callback of the button that organizes the data and plots it %once again i am trying two seperate methods here, hence pyro1 and pyro2. fileinfo_h=File_Input; pyroHandle=guidata(fileinfo_h) pyro1=getappdata(pyroHandle.File_Info,'pnum') pyro2=get(pyroHandle,'UserData') I feel like there's something simple that I'm neglecting, does anyone out there know what that might be? Any guesses at all? Anything can help!!! Thanks
From: Jan Simon on 23 Jul 2010 10:16 Dear Jason, > ??? Undefined function or variable 'File_Input'. The error message is meaningless without seeing the corresponding command. Another simple example: Fig1 = figure('Tag', 'Figure1_Tag', 'Name', 'Figure 1'); set(Fig1, 'UserData', struct('Pi', pi')); Fig2 = figure('Tag', 'Figure2_Tag', 'windowbuttondownfcn', @Fig2_ButtonDown, 'Name', 'Figure 2'); AxesH = axes('Units', 'normalized', 'Position', [0,0,1,1]); set(Fig2, 'UserData', struct('AxesH', AxesH)); And the callback function: function Fig2_ButtonDownFcn(FigH, EventData) Fig1H = findobj(get(0, 'Children'), 'flat', 'Tag', 'Figure1_Tag'); UserData1 = get(Fig1H, 'UserData'); UserData2 = get(FigH, 'UserData'); text(rand, rand, sprintf('%g', UserData1.Pi), ... 'Parent', UserData2.AxesH); end Now click in the Figure2 (I hope it works, I do not run Matlab on my internet computer). If you have 1ooth of open figures, FINDOBJ gets slower. Then you could store Fig1H once in the UserData of Fig2. Perhaps this helps a little bit, Jan
|
Pages: 1 Prev: problem using histc Next: Problems using Real-Time Workshop and Wave Device |