Menu inside menu in Matlab

Hrvi

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 
Xiangrui Li

Your code is fine, except that the returned choice by menu is numeric, not the option strings. So you should use case 1 rather than case 'opt1'.

A good practice for switch is to include otherwise block, like

switch q
    case 1
        % do opt1
    case 2
        % do opt2
    otherwise
        disp(q)
        error('Invalid option')
end

Then you will know it goes to otherwise block due to some error in your case.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Center menu inside div

From Dev

menu is hidden inside div

From Dev

CollapsingToolbarLayout Menu inside a fragment

From Dev

How to move the menu inside the "menu border"

From Dev

A little Pizza menu using MATLAB

From Dev

Dropdown menu hidden inside kendogrid

From Dev

Showing Images inside a dropdown menu

From Dev

Add column/content inside menu

From Dev

User menu dropdown inside a navbar

From Dev

Center DropDown Menu inside itself

From Dev

fireEvent inside a menu Listener errors

From Dev

WinForms add Menu inside Panel

From Dev

Windows 10 UWP app menu flyout inside menu item

From Dev

Get sub menu to stay down we click inside subb menu

From Dev

Windows 10 UWP app menu flyout inside menu item

From Dev

Clickable dropdown menu should not close when clicking inside menu list

From Dev

Apple Script - How to click menu items inside menu of a button?

From Dev

Pop-up menu and graph focus in Matlab

From Dev

How do I add Matlab to the main menu?

From Dev

How do I add Matlab to the main menu?

From Dev

enlarging a div that is inside a drop down menu

From Java

Avoid dropdown menu close on click inside

From Java

Flexbox dropdown menu inside of a Grid item navbar

From Dev

Menu / sidebar with interactive buttons inside item

From Dev

Lost the text boxes values inside the filter menu

From Dev

css menu code content inside a div

From Dev

Scroll the content inside the collapse menu Bootstrap

From Dev

How to move little image inside the menu?

From Dev

css dropdown menu inside unordered list (ul)