Borrar filtros
Borrar filtros

try/catch in gui

11 visualizaciones (últimos 30 días)
anahita
anahita el 1 de Jul. de 2013
Hi
I am a

Respuesta aceptada

Image Analyst
Image Analyst el 1 de Jul. de 2013
Editada: Image Analyst el 1 de Jul. de 2013
Just put it in a while loop until they get it right. Warn them like this:
message = sprintf('Error: you entered %d when you should have entered a number in the range [0,99].', theirNumber);
uiwait(warndlg(message));
In general for a try/catch you can try this:
function blahblahblah()
try
% Some code that generates an error.
catch ME
message = sprintf('Error in blahblahblah():\n%s', ME.message);
uiwait(warndlg(message));
end

Más respuestas (1)

Pourya Alinezhad
Pourya Alinezhad el 1 de Jul. de 2013
just check the input box you created in GUI for numbers below desired value.if input number was bigger than upper bound you can call a error message box GUI.

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by