在其他函数中调用Callback函数(或Callback函数本身)的结果

时间:2016-08-17 12:53:15

标签: matlab callback togglebutton

我有一个生成正弦波的函数。输出显示在GUI中。在那个GUI中,我有一个切换按钮。按下切换按钮功能,可以过滤波形并进行进一步的计算,如RMS。现在我需要的是在按下切换按钮时显示结果波形。

%Calling the result of a GUI Callback function (or the Callback function itself) in
%other function
%=====================
% START USER CODE

function update_display(hObject,eventdata,hfigure)

. 
. 
.

if (toggle_button_IS_pressed) {X is Result of the button Callback function}

    else if (toggle_button_ISNOT_pressed){X is somethingelse}
    end
end
end


% --- Executes on button press in togglebutton8.
function togglebutton8_Callback(hObject, eventdata, handles)
% hObject    handle to togglebutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
X = SomeKind of equation;
end

0 个答案:

没有答案