logKeyPress

Logs each key press and time, and saves to a data file.
152 Downloads
Aktualisiert 26. Jan 2016

Lizenz anzeigen

% logKeyPress(logFileName)
%
% Logs each key press using a figure call-back. The key name and press time
% are both recorded, with the most recent data being displayed on the
% figure.
%
% INPUTS:
% logFileName = string = save file name (optional)
%
% OUTPUTS:
% A .mat file with a data structure: KEY_PRESS_DATA
%
% KEY_PRESS_DATA.time = vector of the times when keys were pressed, in
% units of seconds, with 0.0 corresponding to the time when this function
% was called.
%
% KEY_PRESS_DATA.keyName = cell array of the names of the keys that were
% pressed, matching one to one with the time data.
%
% USAGE:
% Calling this function will start a timer (with tic) and then write the
% name of each key that is pressed, along with the time to a data
% structure.
%
% The most recent data is copied to the figure, for user feedback
%
% Data logging is stopped by pressing the excape key or by
% closing the figure window. Once this occurs, a dialogue box will pop up
% to confirm the file save operation (to prevent accidentally overwriting
% old data), and change the save name if desired.
%
% NOTES:
% The figure is set to be in "modal" style which forces it to the top of
% all other windows. This is done to prevent missing keystrokes. This
% behavior can be changed by simply finding and removing the line:
% >> KEY_LOG_FIG.WindowStyle = 'modal';
%

Zitieren als

Matthew Kelly (2024). logKeyPress (https://www.mathworks.com/matlabcentral/fileexchange/55097-logkeypress), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2015a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.2.0.0

changed name

1.1.0.0

Fixed a memory leak.

1.0.0.0