Character for "ENTER"

20 visualizzazioni (ultimi 30 giorni)
Hg
Hg il 28 Feb 2017
Modificato: Hg il 28 Feb 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

Risposta accettata

Walter Roberson
Walter Roberson il 28 Feb 2017
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

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by