I am trying to make MATLAB code which detect left and right arrow keys of keyboard while there is a figure and record the key strokes.
double(get(gcf,'currentcharacter'))
I tried above function but I don't think it is the one I looked for.
You can use ginput
[~,~,button]=ginput(1);
switch button
case 30 %up
case 31 %down
case 28 %left
case 29 %right
end