How to resolve empty inputdlg box issue?

6 visualizaciones (últimos 30 días)
John Doe
John Doe el 12 de Jul. de 2020
Comentada: Star Strider el 21 de Mayo de 2023
Hello everyone!
I have a inputdlg box. I want the inputdlg box to cancel the processing if the user pressed OK without giving any input in the inputdlg box. How can I do that?
I know how to cancel the processing if Cancel or the close button is pressed.
Thanks in advance!

Respuesta aceptada

Star Strider
Star Strider el 12 de Jul. de 2020
Try this:
a = inputdlg('Type a number:')
if isempty(a{:})
disp('a is empty') % Information Only To Demonstrate That The Test Works
return
end
fprintf('a = %f\n', str2double(a))
.
  2 comentarios
Mpho
Mpho el 21 de Mayo de 2023
Hi, thanks for the helpful answer. Could you please explain what the colon does?
Star Strider
Star Strider el 21 de Mayo de 2023
My pleasure!
The documentation on colon, : can explain it better than I can!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by