assign string to handles structure

1 次查看(过去 30 天)
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

采纳的回答

Adam
Adam 2014-9-22
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by