% Construct a questdlg with three options
function GUI_questionare
y=msgbox('Our analysis of your heart rate indicates you may have borderline or severe sleep apnea, please answer the following questions so that we may give a more precise suggestion,','Attention!')
pause(3);
choice=0;
choice = questdlg(' Do you snore?', ...
	'Options Menu', ...
	'Yes','No','Not sure','No');
category1=0;
% Handle response
ch=0;
ch1=0;
ch2=0;
ch3=0;
ch4=0;
ch5=0;
ch6=0;
ch7=0;
ch8=0;
ch9=0;
ch10=0;
switch choice
    case 'Yes'
        ch = 1;
        category1=category1+1;
    case 'No'
        
        ch = 2;
    case 'Not sure'
        
        ch = 3;
end
if (ch==1||ch==3)
    
arr=[cellstr('Slightly louder than breathing'),cellstr('As loud as talking'),cellstr('Louder than talking'),cellstr('Very loud can be heard in other rooms')];
%bttnChoiseDialog(dlgOptions,dlgTitle, defOption, qStr);
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'Your snoring is:');
% Handle response
switch choice
    case 1
        ch1 = 1;
    case 2
        ch1=2;
    case 3
        ch1=3;
        category1=category1+1;
        
    case 4
        ch1=4;
        category1=category1+1;
end

arr=[cellstr('Almost everyday'),cellstr('3-4 times a week'),cellstr('1-2 times a week'),cellstr('1-2 times a month'),cellstr('Never or almost never')];
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'How often do you snore');
switch choice
    case 1
        ch2=1;
        category1=category1+1;
    case 2
        ch2=2;
        category1=category1+1;
    case 3
        ch2=3;
    case 4
        ch2=4;
end
arr=[cellstr('Yes'),cellstr('No'),cellstr('Dont know')];
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'Does your snoring bother other people?');
switch choice
    case 1
        ch3=1;
        category1=category1+1;
    case 2
        ch3=2;
    case 3
        ch3=3;
end
end
arr=[cellstr('Almost everyday'),cellstr('3-4 times a week'),cellstr('1-2 times a week'),cellstr('1-2 times a month'),cellstr('Never or almost never')];
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'How often has anyone noticed that you quit breathing during your sleep?');
switch choice
    case 1
        ch4=1;
        category1=category1+2;
    case 2
        ch4=2;
        category1=category1+2;
    case 3
        ch4=3;
    case 4
        ch4=4;
end
arr=[cellstr('Almost everyday'),cellstr('3-4 times a week'),cellstr('1-2 times a week'),cellstr('1-2 times a month'),cellstr('Never or almost never')];
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'How often are you tired after sleeping?, that is when you just wake up');
category2=0;
switch choice
    case 1
        ch5=1;
        category2=category2+1;
    case 2
        ch5=2;
        category2=category2+1;
    case 3
        ch5=3;
    case 4
        ch5=4;
end
arr=[cellstr('Almost everyday'),cellstr('3-4 times a week'),cellstr('1-2 times a week'),cellstr('1-2 times a month'),cellstr('Never or almost never')];
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'Do feel fatigued during the rest of the day?');
switch choice
    case 1
        ch7=1;
        category2=category2+1;
    case 2
        ch7=2;
        category2=category2+1;
    case 3
        ch7=3;
    case 4
        ch7=4;
end
choice = questdlg('Have you fallen asleep or noddedd off during driving?', ...
	'Options Menu', ...
	'Yes','No','Yes');
% Handle response
switch choice
    case 'Yes'
        category2=category2+1;
        ch8 = 1;
    case 'No'
        ch8=2;
end
if (ch8==1)
arr=[cellstr('Almost everyday'),cellstr('3-4 times a week'),cellstr('1-2 times a week'),cellstr('1-2 times a month'),cellstr('Never or almost never')];
choice=bttnChoiseDialog(arr,'Sleep Questionare', 1, 'If yes, how often does this occur?');
switch choice
    case 1
        ch9=1;
        category2=category2+1;
    case 2
        ch9=2;
        category2=category2+1;
    case 3
        ch9=3;
    case 4
        ch9=4;
end
end
choice = questdlg('Do you have high blood pressure?', ...
	'Options Menu', ...
	'Yes','No','Not sure');
% Handle response
category3=0;
switch choice
    case 'Yes'
        ch10 = 1;
        category3=1;
    case 'No'
        
        ch10 = 2;
    case 'Not sure'
        
        ch10 = 3;
end
cat1=0;
cat2=0;
cat3=0;
if(category1>=2)
    cat1=1;
end
if(category2>=2)
    cat2=1;
end
if(category3>=1)
    cat3=1;
end
h=0;
k=0;
if(cat1&&cat2==1||cat2&&cat3==1||cat1&&cat3==1||cat1&&cat2&&cat3==1)
    k=num2str(category1+category2+category3);
    h=cat(2,{'You have a very high sleep apnea index of: '} ,k);
    msgbox(cat(2,h,{'Please consult a doctor!'}),'Warning');
else
    msgbox('Although you have a low sleep apnea index, your sleep this night was definitely disturbed by instances of sleep apnea, take care! If this occurs regularly, you must visit a doctor!' ,'Alert');
end
end
    