How Do I Make a Dropdown of UI Elements in a Live Editor Task ?

2 views (last 30 days)
In the Live Editor, Matlab has a built in Live Task, "Create Plot", which has toggleable containers used to show / hide UI Elements. I can't find any documentation on how to replicate this.
The picture above is Matlab's "Create Plot". I'm asking about the toggles on "Select visualization", "Select data", and "Select optional visualization parameters". The picture below is my own Custom Live Editor Task, where "Get Graph" is created using a uigridlayout and a uilabel.

Accepted Answer

Deep
Deep on 21 Aug 2024
Hi Rodney,
I understand that you are working on a custom Live Editor Task, and you wish to add an Accordion component that is utilized by several built-in Live Editor Tasks in MATLAB to provide collapsible sections.
As of R2024a, MATLAB does not provide specific documentation for a dedicated Accordion component to create collapsible sections in Live Editor Tasks. For a workaround, you can mimic this functionality using a toggle logic that simulates the collapsing and expanding behaviour of accordion components.
You can use "uigridlayout" to organize your UI components into sections. Each section can be toggled using a button or label that acts as a switch. For instance, a "uibutton" can control the visibility of a grid layout containing your UI elements. In the button's callback, you can toggle the "Visible" property of the grid layout as follows:
if strcmp(grid.Visible, 'on')
grid.Visible = 'off';
else
grid.Visible = 'on';
end
For more information on the UI components supported by MATLAB, including "uigridlayout" and "uibutton", you can refer to the following documentation resources:
  1. https://www.mathworks.com/help/matlab/develop-apps-using-the-uifigure-function.html
  2. https://www.mathworks.com/help/matlab/ref/uigridlayout.html
  3. https://www.mathworks.com/help/matlab/ref/uibutton.html
Hope this helps!

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!