any function like kbhit
Ältere Kommentare anzeigen
Hi all Is there any function like kbhit(in C) in matlab. I want to use that function inside the for loop to terminate the loop. Thanks in advance
for i=1:100000
if kbhit == 'q'
break;
end
end
Akzeptierte Antwort
Weitere Antworten (3)
Bin Yang
am 21 Nov. 2019
1 Stimme
Replace your kbhit.m with the one attached here, it should work. The original version tried to store key event data in the 'Userdata' property of the command window object, however it is no longer viable in later Matlab versions. What I did was just to asign key event data directly to a global variable.
gang gyoo jin
am 24 Jun. 2016
0 Stimmen
armando herculano
am 1 Apr. 2024
Bearbeitet: armando herculano
am 1 Apr. 2024
0 Stimmen
for MATLAB:
while true
ch = getkey
if ch != 165 break; end
end
----------------------
for OCTAVE
while true
if kbhit(1) break; end
end
-----------------------------
while true
% 165 ASCII code for null
if kbhit(1) != 165 break end
end
--------------------------------------
Kategorien
Mehr zu Calculus finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!