Using checkboxes in GUI to select which functions run

조회 수: 4 (최근 30일)
Connor
Connor 2014년 7월 3일
편집: Joseph Cheng 2014년 7월 3일
I am creating a gui in which I want to have several check boxes to control which wavelets are used for the wavelet transforms of an ecg signal. In otherwords, each checkbox is separate function, but I want a single pushbutton then to set off the functions that are checked. Is there a way to do this so that only the checked check boxes run when the pushbutton is pressed?

채택된 답변

Joseph Cheng
Joseph Cheng 2014년 7월 3일
At the beginning of the pushbutton function have it do a check for which checkboxes are checked off. then use that data to set different flags either perform or skip over those wavelet transforms.
  댓글 수: 1
Joseph Cheng
Joseph Cheng 2014년 7월 3일
편집: Joseph Cheng 2014년 7월 3일
function pushbutton_callback(______)
wavelet1 = get(handles.checkbox1,'value')
wavelet2 = get(handles.checkbox2,'value')
wavelet3 = get(handles.checkbox3,'value')
%etc.
%if statements checking each wavelet.
% or you can also do a for loop to go through something like this.
wavelets = [wavelet1 2*wavelet2 3*wavelet3....];
%multiplication if you leave the default 0 and 1, or change each checkbox to be a specific max value.
for wave = 1:length(wavelets)
switch wavelets(wave)
case 1
wavelet1_function()
case 2
wavelet2_function.
otherwise
continue;
end.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by