function keyboardScan()
hFig = uifigure('Position', [200, 200, 200, 350]);
hText = uilabel(hFig, 'Position', [0, 150, 200, 50], ...
   'FontSize', 30, 'BackgroundColor', 'w', ...
   'HorizontalAlignment', 'center', ...
   'Text', '');
hFig.WindowKeyPressFcn = ...
   @(src, event)keyFcn(hText, event);
end

function keyFcn(hText, event)
hText.Text = sprintf('%s', event.Key);
end