NBUTTONDLG: A Generic Implementation of QUESTBOXDLG

Versión 1.0.0.0 (5,03 KB) por sco1
Generates an n-button question dialog box
76 descargas
Actualizado 12 oct 2022

An expansion over QUESTBOXDLG, which allows up to 3 button selections, NBUTTONDLG(Question, ButtonLabels) creates a modal dialog box that sizes to accomodate a generic number of buttons. The number of buttons is determined by the number of elements in buttonlabels, a 1xn cell array of strings. The name of the button that is pressed is returned as a string in userchoice. NBUTTONDLG will theoretically support an infinite number of buttons. The default parameters are optimized for 4 buttons.
NBUTTONDLG returns the label of the selected button as a character array. If the dialog window is closed without a valid selection the return value is empty.
NBUTTONDLG uses UIWAIT to suspend execution until the user responds.
Example:
UserChoice = nbuttondlg('What is your favorite color?', ...
{'Red', 'Green', 'Blue', 'Yellow'} ...
);
if ~isempty(UserChoice)
fprintf('Your favorite color is %s!\n', UserChoice);
else
fprintf('You have no favorite color :(\n')
end

The Question and ButtonLabel inputs can be followed by parameter/value pairs to specify additional properties of the dialog box. For example, NBUTTONDLG(Question, ButtonLabels, 'DialogTitle', 'This is a Title!') will create a dialog box with the specified Question and ButtonLabels and replace the default figure title with 'This is a Title!'

Citar como

sco1 (2024). NBUTTONDLG: A Generic Implementation of QUESTBOXDLG (https://github.com/StackOverflowMATLABchat/nbuttondlg), GitHub. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2009b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Dialog Boxes en Help Center y MATLAB Answers.
Etiquetas Añadir etiquetas

Community Treasure Hunt

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

Start Hunting!

No se pueden descargar versiones que utilicen la rama predeterminada de GitHub

Versión Publicado Notas de la versión
1.0.0.0

Update version requirement from R2007a to R2009b due to use of tilde operator in function calls.

Fixed handle graphics compatibility issues requiring R2014b or later. Should now work with MATLAB 2007a and later.

Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.