assign string to handles structure

1 view (last 30 days)
Jason
Jason on 22 Sep 2014
Commented: Jason on 22 Sep 2014
Is there a reason why the following is throwing an error ( Undefined function or variable 'hobject'.
Error in Montage>pushbutton1_Callback (line 149) handles.LString=legString;)
obj=get(handles.uipanelColour,'SelectedObject');
strC=get(obj,'Tag')
ImageFiles = dir([folder '\*red.tif*']);
switch strC
case 'rbRed'
ImageFiles = dir([folder '\*red.tif*']);
legString='Red';
case 'rbGreen'
ImageFiles = dir([folder '\*green.tif*']);
legString='Green';
end
%Assign legend String to handles structure so get later
handles.LString=legString;
guidate(hobject,handles); %Update gui handles structure

Accepted Answer

Adam
Adam on 22 Sep 2014
Depending whether you pasted that code in to the question box or just typed it out there are two typos on the final line. If you pasted directly from your code these are likely your problem:
guidate(hobject,handles);
should read
guidata(hObject,handles);
instead.
I would have thought it would throw an error on guidate, but I guess evaluation of the arguments throws its error before the function/variable 'guidate' not existing.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!