inputsdlg: Enhanced Input Dialog Box

version (32.8 KB) by Kesh Ikuma
Predefined dialog box function to accept user inputs of several forms


Updated 30 Jun 2015

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This function is an enhanced version of the standard INPUTDLG function with many additional features:
- 8 control types: text, edit, check, list, range, color, table, button
(**color, table, and button were added in v2.0**)
- Text Type is a static text (e.g., to place an instruction)
- Check Type displays a checkbox with a label, returns one of two values. Value could be logical, integer, or string
- Edit Type can be configured to accept:
* plain text (single- or multi-line mode)
* date (following date formats as defined in DATESTR)
* numeric value (integer or float with attribute specification)
* file or directory name (with UIGETFILE, UIPUTFILE, or UIGETDIR functions, supports UIGETFILE multi-sel
ect mode)
* vector (can specify the length of the vector or the attributes of its elements if the length is fixed or arbitrary). To specify a row vector, include the 'row' keyword in formats.limits field.
- List Type returns index(es) of the selected item and can have 4 different appearances:
* Popupmenu
* Listbox (can be made to multi-select)
* Radiobutton (button placements can be customized)
* Togglebutton (button placements can be customized)
- INPUTSDLG can automatically size controls and dialog box for an optimal appearance, and control's size can be made to auto-adjust if dialog is made resizable.
- INPUTSDLG supports user callbacks to all UI controls as well as dialog's CreateFcn and DeleteFcn callbacks. The callback function takes additional input arguments to standard MATLAB callback arguments.
- INPUTSDLG returns the user entries in a cell or in a structure
- INPUTSDLG is backward compatible with INPUTDLG except for its returned values when canceled. With default answers given, INPUTDLG returns an empty cell while INPUTSDLG returns the default answers. INPUTSDLG returns the second parameter, CANCELED(a logical flag) to indicate how the dialog box is terminated.
- Luke Reisner prepared v1.3 and kindly shared his modification/bug fixes.
- Florian Hatz initiated the development of v2.0 with his ideas of adding table, color, and tiling option

Cite As

Kesh Ikuma (2022). inputsdlg: Enhanced Input Dialog Box (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!