我有一個2D圖(HHH手柄)與圖像c完成,如果按下單選按鈕,我想添加一行,並刪除按鈕釋放時相同的留置權。matlab uicontrol單選按鈕問題
當按鈕被按下的行顯示OK,但如果按鈕被釋放後有這樣的錯誤:
未定義的函數或變量「HLINE」
Lokks行程序不容記得HLINE價值,即使它正在更新與guidata。我究竟做錯了什麼?由於
下面是函數
function abc(x)
% x is a m x n matrix
hhh=imagesc(x)
% now a pushbutton to put or remove a line in the above plot
uicontrol('Style','radiobutton','String','put_remove_line',...
'units','normalized','pos', [tf_left 0 .1/2 1/25],'parent',hhh,'HandleVisibility','on', 'fontSize',6,'Callback',{@put_remove_line ,delta_f_line, hhh ,Hline});
end % end abc function
%radiobutton callback function
function put_remove_line(hObject,event,delta_f_line,hhh,Hline)
a=get(hObject,'Value');
if a % if button is pressed a
axes(hhh)
xlimits=get(gca,'XLim');
Hline.xxx=line(xlimits,[delta_f_line], 'LineStyle',':','LineWidth',2);
else
delete(Hline.xxx,)
end
guidata(hObject,Hline)
end
許多很多謝謝,我會看到這一點,目前我們已經使用全球xxx,看起來不是最好的解決方案... –