Main Content

helpdlg

Create help dialog box

Description

Note

In App Designer and apps created with the uifigure function, uialert is recommended over helpdlg because it provides additional customization options.

helpdlg creates a nonmodal help dialog box with the default title, Help Dialog, and the default message, This is the default help.

Use this function if you want to show a help dialog box over multiple app windows, the MATLAB® desktop, or Simulink® and still be able to interact with them before responding to the dialog box.

helpdlg(msg) specifies custom message text. If a dialog box with a matching dialog box title already exists, then MATLAB brings it to the front.

example

helpdlg(msg,title) specifies a custom title for the dialog box.

example

f = helpdlg(___) returns the figure object. You can use this syntax with any of the input arguments from the previous syntaxes.

Examples

collapse all

helpdlg("Consider using a cell array.")

Help dialog box with the title "Help Dialog", a blue icon that contains the letter "i", the message "Consider using a cell array", and an OK button

Specify the help dialog box text using a string array. Line breaks occur after each array element.

helpdlg(["Valid data types are:","int8", ...
    "int16","int32","int64"])

Help dialog box. The message lists valid data types with each data type on its own line.

Create a dialog box with a custom title and message.

helpdlg("Choose 10 points from the figure",...
    "Point Selection")

Help dialog box with the title "Point Selection" and the message "Choose 10 points from the figure"

If the dialog box is not visible, it might be buried under other windows. Issue the command again to bring it to the front.

helpdlg("Choose 10 points from the figure", ...
    "Point Selection")

Now, change the message by calling helpdlg again using the same title with a different message.

helpdlg("Choose 5 points from the figure", ...
    "Point Selection")

After you create a dialog box, each time you call helpdlg and specify the same title, MATLAB brings that dialog box to the front. If the dialog box title is unchanged, then MATLAB only creates a new dialog box if you close the dialog box between calls to helpdlg.

Input Arguments

collapse all

Help message, specified as a character vector, string scalar, cell array of character vectors, or string array.

  • If you specify the help message as a character vector or a string scalar, then a long message wraps to fit the dialog box.

  • If you specify the help message as a cell array of character vectors or a string array, then lines breaks occur between each array element. Long elements wrap to fit the dialog box.

Example: "This value is required."

Example: {'Valid data types are:','int8','int16','int32','int64'}

Dialog box title, specified as a character vector or a string scalar.

Example: "Value Specification"

More About

collapse all

Modal Dialog Box

A modal dialog box prevents a user from interacting with other MATLAB windows before responding to the dialog box.

Nonmodal Dialog Box

A nonmodal dialog box enables a user to interact with other MATLAB windows before responding to the dialog box. A nonmodal dialog box is also referred to as a normal dialog box.

Tips

  • MATLAB program execution continues even when a modal help dialog box is active. To block program execution until the user closes the dialog box, use the uiwait function.

  • To create a modal alert dialog box for single-window App Designer or uifigure-based apps, use the uialert function instead.

Version History

Introduced before R2006a