ProgressDialog Properties

Control appearance and behavior of progress dialog box

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:

uf = uifigure;
d = uiprogressdlg(uf);
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.

'' (default)No icon displays.





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.


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'. Set this property to 'on' to display the fraction complete as a percentage in the dialog box.

Indeterminate progress, specified as 'off' or 'on'. 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.


expand all

Allow cancellation, specified as 'off' or 'on'. 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