Character for "ENTER"

12 vues (au cours des 30 derniers jours)
Hg
Hg le 28 Fév 2017
Modifié(e) : Hg le 28 Fév 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

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Fév 2017
Use CurrentKey 'Enter'
Otherwise, char(10)
  1 commentaire
Hg
Hg le 28 Fév 2017
Modifié(e) : Hg le 28 Fév 2017
It seems like char(10) is for Windows. In my case, which is Windows on a Macbook, only char(13) works.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by