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.
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.
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!
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);
existingText = get(statusbar(myHandle),'Text');
Examples customizing the status-bar appearance:
sb = statusbar('text');
set(sb.TextPanel, 'Foreground',java.awt.Color(1,0,0), 'Background',java.awt.Color.cyan, 'ToolTipText','tool tip...')
Additional examples are provided in the utility's help section.
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)