I want to break a loop by pressing ENTER key. What character does ENTER key represent?
while (1)
if strcmp(get(gcf,'currentcharacter'),'??');
break;
end
end

 Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Feb. de 2017

0 votos

Use CurrentKey 'Enter'
Otherwise, char(10)

1 comentario

Hg
Hg el 28 de Feb. de 2017
Editada: Hg el 28 de Feb. de 2017
It seems like char(10) is for Windows. In my case, which is Windows on a Macbook, only char(13) works.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

Hg
el 28 de Feb. de 2017

Editada:

Hg
el 28 de Feb. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by