Character for "ENTER"

12 visualizaciones (últimos 30 días)
Hg
Hg el 28 de Feb. de 2017
Editada: Hg el 28 de Feb. de 2017
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
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

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by