ProgressDialog Properties

Control progress dialog box appearance and behavior

Progress dialog boxes indicate that an operation is in progress by displaying an animated progress bar. The uiprogressdlg function creates a progress dialog box and sets any required properties before displaying it. By changing property values of a progress dialog box, you can modify certain aspects of its appearance and behavior. Use dot notation to refer to a specific object and property:

fig = uifigure;
d = uiprogressdlg(fig);
d.Value = .25;

Text and Styling

expand all

Message, specified as a character vector, cell array of character vectors, or string array. The message displays within the dialog box, above the progress bar.

To display multiple lines of text, specify a cell array of character vectors or a string array. Each element in the array corresponds to a line of text. Hard breaks within each element, such as '\n', create additional lines of text.

Example: d = uiprogressdlg(uifigure,'Message','Calculating result.');

Title, specified as a character vector or a string scalar. The title displays in the title bar of the dialog box.

Example: d = uiprogressdlg(uifigure,'Title','Calculating');

Icon, specified as a predefined icon or a custom icon.

Predefined Icon

This table lists the values for the predefined icons.

ValueIcon
'' (default)No icon displays.
'question'

'info'

'success'

'warning'

'error'

Custom Icon

Specify a custom icon as one of these values:

  • A character vector or string scalar that specifies the file name of an SVG, JPEG, GIF, or PNG image that is on the MATLAB® path. Alternatively, you can specify a full path to the image file.

  • A truecolor image array. See Image Types for more information.

Progress

expand all

Fraction complete, specified as a number between 0 and 1. The progress bar reaches its full length when the value is 1. Change Value at different points in your code to provide a visual indication of progress in the running app.

Data Types: double

Show percentage, specified as 'off' or 'on', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

Set this property to 'on' to display the fraction complete as a percentage in the dialog box.

Indeterminate progress, specified as 'off' or 'on', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

Set this property to 'on' to provide an animated bar without any specific progress information. This animation is useful when you do not know how long a calculation will take.

To prevent indeterminate progress bars from displaying indefinitely, call the close function after completing your calculations.

Interactivity

expand all

Allow cancellation, specified as 'off' or 'on', or as numeric or logical 1 (true) or 0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

A value of 'on' displays a cancel button in the dialog box. You can customize the button label by specifying the CancelText property.

When you allow cancellation, you must check the value of the CancelRequested property, and call the close function when the value is true. Otherwise, the dialog box displays indefinitely.

Cancel button text, specified as a character vector or string scalar. This property has an effect only when the Cancelable property is set to 'on'.

Example: d = uiprogressdlg(uifigure,'Cancelable','on','CancelText','Stop')

Cancel requested, specified as true or false. Use this property when Cancelable is 'on', and you want to know whether the user clicked the cancel button. This property is false until the user clicks the cancel button, then the value changes to true.

Introduced in R2018a