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

조회 수: 1 (최근 30일)
RODNEY
RODNEY 2024년 8월 20일
답변: Deep 2024년 8월 21일
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.

채택된 답변

Deep
Deep 2024년 8월 21일
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!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by