Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem passing handles structure

Status
Not open for further replies.

rn14

Structural
Aug 30, 2006
79
I have a problem with a GUI I have been working on (generated with GUIDE). In one function I assign a value to a variable and then put it in the handles structure and update it...

units_x = 'in';
handles.units_x = units_x;
guidata(hObject, handles);

but when I try and use handles.units_x in a later function Matlab tells me field units_x does not exist. I managed to get the first function to pass the handles by making it an output of the function
like this...

[x y handles] = function whateva(hObject, handles)

It works but it seems like I should have to do it this way,
especially since this is the only function in which I have had to pass the handles this way.
Thanks for any help.
 
Replies continue below

Recommended for you

Read this it explains how variables work in Matlab and has various links in the same page to many programing tips for matlab.

BSK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor