2013-08-20 71 views
0

我有5個不同的過濾器,作爲MATLAB GUI中的5個不同的單選按鈕。我把它們變成了一個按鈕組,現在當我點擊每個按鈕時,通過軸顯示噪聲圖像。但我想以這種方式設置按鈕組,只顯示一個過濾器(一個圖像)。所以,我遵循這個在這裏給出的stackoverflow這 (How to pass function to radio button in a button group created using guide in MATLAB?)。但是我們如何在一個軸上「設置」圖像。 我附上了我的GUI圖。 enter image description here如何有效地使用按鈕組中的單選按鈕MATLAB GUI

在此先感謝

回答

0

您在axes對象使用正常的繪圖命令「設置」的形象。假設變量ax持有的軸對象,你要畫上的手柄,你可以寫:

axes(ax);  % Select the chosen axes as the current axes 
cla;   % Clear the axes 
imagesc(im); % Now draw whatever you want - for example, an image. 

順便說一句,在指南中,您可以得到通常得到的軸手柄使用handles參數傳遞給所有的回調。因此,例如,如果您的座標軸被稱爲axes1,則您的按鈕組回調可能如下所示:

function uipanel1_SelectionChangeFcn(hObject, eventdata, handles) 
    ax = handles.axes1; % Get handle to axes 
    axes(ax);   % Select the chosen axes as the current axes 
    cla;     % Clear the axes 
    imagesc(rand(50)); % Now draw