Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
17
Добавлен:
09.02.2015
Размер:
257.02 Кб
Скачать

It sets the figure properties that are recommended for dialog boxes.

These properties and their corresponding values are:

'BackingStore' - 'off'

'ButtonDownFcn' - 'if isempty(allchild(gcbf)), close(gcbf), end'

'Colormap' - []

'Color' - DefaultUicontrolBackgroundColor

'DockControls' - 'off'

'HandleVisibility' - 'callback'

'IntegerHandle' - 'off'

'InvertHardcopy' - 'off'

'MenuBar' - 'none'

'NumberTitle' - 'off'

'PaperPositionMode' - 'auto'

'Resize' - 'off'

'Visible' - 'on'

'WindowStyle' - 'modal'

Any parameter from the figure command is valid for this command.

Example:

out = dialog;

out = dialog('WindowStyle', 'normal', 'Name', 'My Dialog');

See also errordlg, figure, helpdlg, inputdlg, listdlg,

msgbox, questdlg, uiresume, uiwait, warndlg.

Reference page in Help browser

doc dialog

<errordlg> - Error dialog box.

ERRORDLG Error dialog box.

HANDLE = ERRORDLG(ERRORSTRING,DLGNAME) creates an error dialog box which

displays ERRORSTRING in a window named DLGNAME. A pushbutton labeled OK

must be pressed to make the error box disappear.

HANDLE = ERRORDLG(ERRORSTRING,DLGNAME,CREATEMODE) allows CREATEMODE

options that are the same as those offered by MSGBOX. The default value

for CREATEMODE is 'non-modal'.

ErrorString will accept any valid string input but a cell array is

preferred.

ERRORDLG uses MSGBOX. Please see the help for MSGBOX for a full

description of the input arguments to ERRORDLG.

Example:

f = errordlg('This is an error string.', 'My Error Dialog');

f = errordlg('This is an error string.', 'My Error Dialog', 'modal');

See also dialog, helpdlg, inputdlg, listdlg, msgbox,

questdlg, warndlg.

Reference page in Help browser

doc errordlg

<helpdlg> - Help dialog box.

HELPDLG Help dialog box.

HANDLE = HELPDLG(HELPSTRING,DLGNAME) displays the

message HelpString in a dialog box with title DLGNAME.

If a Help dialog with that name is already on the screen,

it is brought to the front. Otherwise a new one is created.

HelpString will accept any valid string input but a cell

array is preferred.

Example:

h = helpdlg('This is a help string','My Help Dialog');

See also dialog, errordlg, inputdlg, listdlg, msgbox,

questdlg, warndlg.

Reference page in Help browser

doc helpdlg

<inputdlg> - Input dialog box.

INPUTDLG Input dialog box.

ANSWER = INPUTDLG(PROMPT) creates a modal dialog box that returns user

input for multiple prompts in the cell array ANSWER. PROMPT is a cell

array containing the PROMPT strings.

INPUTDLG uses UIWAIT to suspend execution until the user responds.

ANSWER = INPUTDLG(PROMPT,NAME) specifies the title for the dialog.

ANSWER = INPUTDLG(PROMPT,NAME,NUMLINES) specifies the number of lines for

each answer in NUMLINES. NUMLINES may be a constant value or a column

vector having one element per PROMPT that specifies how many lines per

input field. NUMLINES may also be a matrix where the first column

specifies how many rows for the input field and the second column

specifies how many columns wide the input field should be.

ANSWER = INPUTDLG(PROMPT,NAME,NUMLINES,DEFAULTANSWER) specifies the

default answer to display for each PROMPT. DEFAULTANSWER must contain

the same number of elements as PROMPT and must be a cell array of

strings.

ANSWER = INPUTDLG(PROMPT,NAME,NUMLINES,DEFAULTANSWER,OPTIONS) specifies

additional options. If OPTIONS is the string 'on', the dialog is made

resizable. If OPTIONS is a structure, the fields Resize, WindowStyle, and

Interpreter are recognized. Resize can be either 'on' or

'off'. WindowStyle can be either 'normal' or 'modal'. Interpreter can be

either 'none' or 'tex'. If Interpreter is 'tex', the prompt strings are

rendered using LaTeX.

Examples:

prompt={'Enter the matrix size for x^2:','Enter the colormap name:'};

name='Input for Peaks function';

numlines=1;

defaultanswer={'20','hsv'};

answer=inputdlg(prompt,name,numlines,defaultanswer);

options.Resize='on';

options.WindowStyle='normal';

options.Interpreter='tex';

answer=inputdlg(prompt,name,numlines,defaultanswer,options);

See also dialog, errordlg, helpdlg, listdlg, msgbox,

questdlg, textwrap, uiwait, warndlg .

Reference page in Help browser

doc inputdlg

<listdlg> - List selection dialog box.

LISTDLG List selection dialog box.

[SELECTION,OK] = LISTDLG('ListString',S) creates a modal dialog box

which allows you to select a string or multiple strings from a list.

SELECTION is a vector of indices of the selected strings (length 1 in

the single selection mode). This will be [] when OK is 0. OK is 1 if

you push the OK button, or 0 if you push the Cancel button or close the

figure.

Double-clicking on an item or pressing <CR> when multiple items are

selected has the same effect as clicking the OK button. Pressing <CR>

is the same as clicking the OK button. Pressing <ESC> is the same as

clicking the Cancel button.

Inputs are in parameter,value pairs:

Parameter Description

'ListString' cell array of strings for the list box.

'SelectionMode' string; can be 'single' or 'multiple'; defaults to

'multiple'.

'ListSize' [width height] of listbox in pixels; defaults

to [160 300].

'InitialValue' vector of indices of which items of the list box

are initially selected; defaults to the first item.

'Name' String for the figure's title; defaults to ''.

'PromptString' string matrix or cell array of strings which appears

as text above the list box; defaults to {}.

'OKString' string for the OK button; defaults to 'OK'.

'CancelString' string for the Cancel button; defaults to 'Cancel'.

A 'Select all' button is provided in the multiple selection case.

Example:

d = dir;

str = {d.name};

[s,v] = listdlg('PromptString','Select a file:',...

'SelectionMode','single',...

'ListString',str)

See also dialog, errordlg, helpdlg, inputdlg,

msgbox, questdlg, warndlg.

Reference page in Help browser

doc listdlg

<menu> - Generate a menu of choices for user input.

MENU Generate a menu of choices for user input.

CHOICE = MENU(HEADER, ITEM1, ITEM2, ... ) displays the HEADER

string followed in sequence by the menu-item strings: ITEM1, ITEM2,

... ITEMn. Returns the number of the selected menu-item as CHOICE,

a scalar value. There is no limit to the number of menu items.

CHOICE = MENU(HEADER, ITEMLIST) where ITEMLIST is a string, cell

array is also a valid syntax.

On most graphics terminals MENU will display the menu-items as push

buttons in a figure window, otherwise they will be given as a numbered

list in the command window (see example, below).

Example:

K = menu('Choose a color','Red','Blue','Green')

%creates a figure with buttons labeled 'Red', 'Blue' and 'Green'

%The button clicked by the user is returned as K (i.e. K = 2

implies that the user selected Blue).

See also uicontrol, uimenu, guide.

Reference page in Help browser

doc menu

<msgbox> - Message box.

MSGBOX Message box.

msgbox(Message) creates a message box that automatically wraps

Message to fit an appropriately sized Figure. Message is a string

vector, string matrix or cell array.

msgbox(Message,Title) specifies the title of the message box.

msgbox(Message,Title,Icon) specifies which Icon to display in

the message box. Icon is 'none', 'error', 'help', 'warn', or

'custom'. The default is 'none'.

msgbox(Message,Title,'custom',IconData,IconCMap) defines a

customized icon. IconData contains image data defining the icon;

IconCMap is the colormap used for the image.

msgbox(Message,...,CreateMode) specifies whether a message box is modal

or non-modal. Valid values for CreateMode are 'modal', 'non-modal', and

'replace'. If CreateMode is 'modal' or 'replace', the first available

message box with the specified title is updated to reflect the new

properties of the message box. All other such message boxes are deleted.

If CreateMode is 'non-modal', the message-box is not replaced and a new

handle is created. The default value for CreateMode is 'non-modal'.

CreateMode may also be a structure with fields WindowStyle and

Interpreter. WindowStyle may be any of the values above.

Interpreter may be 'tex' or 'none'. The default value for the

Interpreter is 'none';

h = msgbox(...) returns the handle of the box in h.

To make msgbox block execution until the user responds, include the

string 'modal' in the input argument list and wrap the call to

msgbox with UIWAIT.

Examples:

%An example which blocks execution until the user responds:

uiwait(msgbox('String','Title','modal'));

%An example using a custom Icon is:

Data=1:64;Data=(Data'*Data)/64;

h=msgbox('String','Title','custom',Data,hot(64))

%An example which reuses the existing msgbox window:

CreateStruct.WindowStyle='replace';

CreateStruct.Interpreter='tex';

h=msgbox('X^2 + Y^2','Title','custom',Data,hot(64),CreateStruct);

See also dialog, errordlg, helpdlg, inputdlg, listdlg,

questdlg, textwrap, uiwait, warndlg.

Reference page in Help browser

doc msgbox

<questdlg> - Question dialog box.

QUESTDLG Question dialog box.

ButtonName = QUESTDLG(Question) creates a modal dialog box that

automatically wraps the cell array or string (vector or matrix)

Question to fit an appropriately sized window. The name of the

button that is pressed is returned in ButtonName. The Title of

the figure may be specified by adding a second string argument:

ButtonName = questdlg(Question, Title)

Question will be interpreted as a normal string.

QUESTDLG uses UIWAIT to suspend execution until the user responds.

The default set of buttons names for QUESTDLG are 'Yes','No' and

'Cancel'. The default answer for the above calling syntax is 'Yes'.

This can be changed by adding a third argument which specifies the

default Button:

ButtonName = questdlg(Question, Title, 'No')

Up to 3 custom button names may be specified by entering

the button string name(s) as additional arguments to the function

call. If custom button names are entered, the default button

must be specified by adding an extra argument, DEFAULT, and

setting DEFAULT to the same string name as the button you want

to use as the default button:

ButtonName = questdlg(Question, Title, Btn1, Btn2, DEFAULT);

where DEFAULT is set to Btn1. This makes Btn1 the default answer.

If the DEFAULT string does not match any of the button string names,

a warning message is displayed.

To use TeX interpretation for the Question string, a data

structure must be used for the last argument, i.e.

ButtonName = questdlg(Question, Title, Btn1, Btn2, OPTIONS);

The OPTIONS structure must include the fields Default and Interpreter.

Interpreter may be 'none' or 'tex' and Default is the default button

name to be used.

If the dialog is closed without a valid selection, the return value

is empty.

Example:

ButtonName = questdlg('What is your favorite color?', ...

'Color Question', ...

'Red', 'Green', 'Blue', 'Green');

switch ButtonName,

case 'Red',

disp('Your favorite color is Red');

case 'Blue',

disp('Your favorite color is Blue.')

case 'Green',

disp('Your favorite color is Green.');

end % switch

See also dialog, errordlg, helpdlg, inputdlg, listdlg,

msgbox, warndlg, figure, textwrap, uiwait, uiresume.

Reference page in Help browser

doc questdlg

<uigetdir> - Standard open directory dialog box

UIGETDIR Standard open directory dialog box

DIRECTORYNAME = UIGETDIR(STARTPATH, TITLE)

displays a dialog box for the user to browse through the directory

structure and select a directory, and returns the directory name

as a string. A successful return occurs if the directory exists.

The STARTPATH parameter determines the initial display of directories

and files in the dialog box.

When STARTPATH is empty the dialog box opens in the current directory.

When STARTPATH is a string representing a valid directory path, the

dialog box opens in the specified directory.

When STARTPATH is not a valid directory path, the dialog box opens

Соседние файлы в папке Библиотеки Matlab