assign string to handles structure

2 Ansichten (letzte 30 Tage)
Jason
Jason am 22 Sep. 2014
Kommentiert: Jason am 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

Akzeptierte Antwort

Adam
Adam am 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.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by