0

私の GUI には、1 つの検索ボタンの下にcolourcheckとの2 つのチェックボックスがあります。Texturecheck検索ボタンをクリックすると、上記の両方のタイプがチェックされ、それぞれのプログラムが実行されます。また、両方のボックスが「MIN」の位置にある場合、つまりチェックされていない場合は、ユーザーにメッセージが表示されますselect type of search

search_callback プログラムをクリップしました。

function Search_Callback(hObject, eventdata, handles)
% hObject    handle to Search (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data


% --- Executes on button press in colourcheck.
function colourcheck_Callback(hObject, eventdata, handles)
% hObject    handle to colourcheck (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data

% Hint: get(hObject,'Value') returns toggle state of colourcheck
if (get(hObject,'Value') == get(hObject,'Max'))
    Search_Callback(hObject, eventdata, handles)
else
   % Checkbox is not checked-take approriate action
end

しかし、私は要件を満たすことができません。私を助けてください、どんな解決策もかなりのものです。

4

1 に答える 1

1

Search_Callback質問の説明から、をクリックしたときに呼び出されたくありませんcolourcheck_Callback。代わりに、どのチェック ボックスが選択されているかに基づいて、検索ボタンがクリックされたときに他のアクションを実行する必要があります。検索ボタンに次のようなコールバックを使用できます。

% --- Executes on button press in search.
function search_Callback(hObject, eventdata, handles)
% hObject    handle to search (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

isTexture = get(handles.Texturecheck,'Value');
isColour = get(handles.colourCheck,'Value');
if and(isTexture, isColour)
    'do something'
elseif isColour
    'do something else'
elseif isTexture
    'do something else'
else
    'warn user'
end
guidata(hObject, handles);
于 2013-03-15T19:53:26.203 に答える