by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Realtime Roundrobin
Introduced first in SolidGeometry 3.5, Creation date: 2017-03-02, Last change: 2025-08-19
RRkeyboardCallback
This algorithm is a callback function named RRkeyboardCallback designed to handle keyboard input in a MATLAB figure window. It interacts with global variables to manage and execute command lines based on user input.
src: The source of the event, typically the figure window.event: An event structure containing information about the keyboard event, including the character and key pressed.RRkeyboardCurs: A global string variable that collects characters entered by the user before execution.RRkeyboardLine: A global string variable that stores the full command line to be executed after the Enter key (CR) is pressed.event structure using event.Character and store it in variable A.uint8(A) and store it in variable B.B is not equal to 1. If true, exit the function.switch statement to handle different ASCII values of B:case 13: If the Enter key (CR) is pressed, assign RRkeyboardCurs to RRkeyboardLine and reset RRkeyboardCurs to an empty string.otherwise: If the key is 'v' and the 'command' modifier is pressed, paste the clipboard content into A and filter it to include only printable ASCII characters (32 to 128). Append A to RRkeyboardCurs.A to the command window using fprintf.