statusbar

set/get status bar(s) for GUI figures & Matlab desktop
11,2K Downloads
Aktualisiert 17. Jun 2018

Lizenz anzeigen

statusbar sets the status-bar text of the Matlab desktop or a figure. statusbar accepts arguments in the format accepted by the sprintf function and returns the statusbar handle(s), if available.

Syntax:
statusbarHandle = statusbar(handle, text, sprintf_args...)

statusbar(text, ...) sets the status bar text for the currently selected figure. If no figure is selected, then one will be created. Note that figures with 'HandleVisibility' turned off will be skipped. In these cases, simply pass their figure handle as first argument.

statusbar(handle, ...) sets the status bar text of the figure handle (or the figure which contains handle). If the status bar was not yet displayed for this figure, it will be created and displayed. If text is not supplied, then any existing status bar is erased, unlike statusbar(handle, '') which just clears the text.

statusbar(0, ...) sets the Matlab desktop's status bar text. If text is not supplied, then any existing text is erased, like statusbar(0, '').

statusbar([handles], ...) sets the status bar text of all the requested handles.

statusbarHandle = statusbar(...) returns the status bar handle for the selected figure. The Matlab desktop does not expose its statusbar object, so statusbar(0, ...) always returns []. If multiple unique figure handles were requested, then statusbarHandle is an array of all non-empty status bar handles.

Technical description:
http://UndocumentedMatlab.com/blog/setting-status-bar-text
http://UndocumentedMatlab.com/blog/setting-status-bar-components

Notes:
1) The format statusbarHandle = statusbar(handle) does NOT erase any existing statusbar, but just returns the handles.
2) The status bar is 20 pixels high across the entire bottom of the figure. It hides everything between pixel heights 0-20, even parts of uicontrols, regardless of who was created first!

Examples:
statusbar; % delete status bar from current figure
statusbar(0, 'Desktop status: processing...');
statusbar([hFig1,hFig2], 'Please wait while processing...');
statusbar('Processing %d of %d (%.1f%%)...',idx,total,100*idx/total);
statusbar('Running... [%s%s]',repmat('*',1,fix(N*idx/total)),repmat('.',1,N-fix(N*idx/total)));
existingText = get(statusbar(myHandle),'Text');

Examples customizing the status-bar appearance:
sb = statusbar('text');
set(sb.CornerGrip, 'visible',false);
set(sb.TextPanel, 'Foreground',java.awt.Color(1,0,0), 'Background',java.awt.Color.cyan, 'ToolTipText','tool tip...')
set(sb, 'Background',java.awt.Color.cyan);

Additional examples are provided in the utility's help section.
Warning:
This code heavily relies on undocumented and unsupported Matlab
functionality. It works on Matlab 7+, but use at your own risk!

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

Zitieren als

Yair Altman (2024). statusbar (https://www.mathworks.com/matlabcentral/fileexchange/14773-statusbar), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2007a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.8.0.0

Fixes for HG2; fixed indeterminite progress-bar usage example

1.6.0.0

Updated usage examples (no changes to the code)

1.5.0.0

Updated usage examples (no changes to the code)

1.4.0.0

Updated usage examples (no changes to the code)

1.3.0.0

Updated submission title (no code change)

1.2.0.0

Fix for R2014b

1.1.0.0

Fix for R2011b

1.0.0.0

Added partial support for Matlab 6