How to have a multiple choice questionnaire that will ask the next question depending on the answer?
13 views (last 30 days)
I am trying to have a multiple-choice questionnairequestionnaire, that will go to the next step (in this case, the next question) depending on what you answer.
What is the best approach for this? I was thinking of using an if-else statement; however, I don't know how to have a multiple choice question.
I really hope you guys can help me with this!
Jos (10584) on 17 Oct 2019
Take a look at all the dialog functions in matlab like questdlg, listdlg etc.
Start however drawing a graph of all the questions and the paths to the next questions depening on the answers. In your code you can use if-else-end or, even better, switch-case-end constructs
answer = questdlg(...)
case 'A' % ask follow-up 1
case 'B' % ask follow-up 2