Gui
- From: MattM <matthew.menard@xxxxxxxx>
- Date: Mon, 19 Nov 2007 08:19:20 -0800 (PST)
I'm new to gui creation in Matlab, and I have (I hope) a fairly simply
question. I created a very simple gui using GUIDE. It has one edit
text box and a push button. GUIDE created a M file for me with the
callbacks. All seems to work except the MyGUI_OutputFcn callback (is
that called a callback as well?). But anyway, the other functions
seem to work correctly except this one. It seems to run the code (I
have some display commands that it sends to standard output), but it
appears that the input variables to the callback don't exist anymore.
This is what it look like:
function varargout = MyGUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
%data = guidata(handles.output);
%varargout{1} = handles.output;
%figure = gcbf;
%hand = guihandles;
display 'It is here';
%handles.figure1;
%hObject;
%fig = gcf;
data = guidata(handles.output);
display 'Did it get here?';
%sprintf('The handles are: %s',hand);
%data = guidata(handles.figure1);
%display 'Its now here';
varargout{1} = data.scaleFactor;
%varargout{1} = handles.output;
%varargout{2} = handles.scaleFactor;
As is probably clear in the code that's commented out, I tried a few
different things. My question is, Why don't the input variables
handles or hObject seem to exist when I try to access them in the
callback? It gives various errors, with the current one being
Attempt to reference field of non-structure array.
and it points to the line "data = guidata(handles.output);"
I tried it with "data = guidata(hObject);"
but that gives the error message:
H must be the handle to a figure or figure descendent.
and points to that line of code.
It's almost as if those input variables don't exist any more. Any
ideas or input would be greatly appreciated. Thanks
MattM
.
- Follow-Ups:
- Re: Gui
- From: David
- Re: Gui
- Prev by Date: How to display variable in GUI while simulation running
- Next by Date: Re: gui + workspace question
- Previous by thread: How to display variable in GUI while simulation running
- Next by thread: Re: Gui
- Index(es):