Character for "ENTER"

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

 Risposta accettata

Walter Roberson
Walter Roberson il 28 Feb 2017

0 voti

Use CurrentKey 'Enter'
Otherwise, char(10)

1 Commento

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

Accedi per commentare.

Più risposte (0)

Categorie

Prodotti

Richiesto:

Hg
il 28 Feb 2017

Modificato:

Hg
il 28 Feb 2017

Community Treasure Hunt

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

Start Hunting!

Translated by