How can I add or remove the menubar or toolbar from a figure in MATLAB?

조회 수: 457(최근 30일)
How can I add or remove the menubar or toolbar from a figure in MATLAB?
I want to control whether the menubar and toolbar appear in a figure. Can I turn them on or off?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2013년 4월 2일
You can use SET command to change the MenuBar and Toolbar properties of the figure to control whether the menubar and toolbar are shown in a MATLAB figure.
The possible values for Menu Bar are:
'none' - the menubar is not shown
'figure' - the menubar is shown
The possible values for ToolBar are:
'none' - the toolbar is not shown
'auto' - the toolbar is controlled by the menubar. If MenuBar is set to 'figure', then the toolbar is shown. If 'MenuBar is set to 'none', then the toolbar isn't shown.
'figure' - the toolbar is shown
For example, the following code will open a figure without the menubar and toolbar:
hFigure = figure;
set(hFigure, 'MenuBar', 'none');
set(hFigure, 'ToolBar', 'none');
  댓글 수: 2
kh rezaee
kh rezaee 2022년 4월 15일
Hi. In the 2020 version, I was able to edit the output after I used your command for training progress figure. However, I am unable to edit the figure in version 2022, and I receive the following error message. Is there a way to make the menu appear?
h= findall(groot,'Type','Figure');
h.MenuBar = 'figure';
error--->>> Functionality not supported with figures created with the uifigure function.

댓글을 달려면 로그인하십시오.

추가 답변(1개)

KAE 2022년 4월 7일
편집: KAE 2022년 4월 7일
Even with the instructions, there is still a white bar at the top of the figure, like in screnshot below. (The rest of the figure in the screenshot is black).
How can I get rid of this white bar? What is it called if it's not the Menu Bar or Tool Bar? I don't see any other kinds of "bars" listed in figure properties.
  댓글 수: 2
Steven Lord
Steven Lord 2022년 4월 7일
The description of the 'fullscreen' value for the figure property WindowState doesn't give that bar a name; it just says "the minimize, restore, and close buttons provided by the operating system". So maybe we could call it the "system controls bar"?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by