I have created a menu with different options using order 'menu'. The problem is, that I want to click one of that options and make another menu show in screen with another set of options. How can I make this kind of nested menu structure?
My code:
q=menu ('What point?:','opt1','opt2');
switch q
case 'opt1'
q1=menu('What subpoint?:','opt11','opt12');
switch q1
case 'opt11'
case 'opt12'
end
case 'opt2'
q2=menu('What subpoint?:','opt21','opt22');
switch q2
case 'opt21'
case 'opt22'
end
end
Your code is fine, except that the returned choice by
menuis numeric, not the option strings. So you should usecase 1rather thancase 'opt1'.A good practice for
switchis to includeotherwiseblock, likeThen you will know it goes to
otherwiseblock due to some error in your case.