From: Stephane Poirier on
The code below (matlab code) selects the proper window (in this case a mathworks matlab figure) and then throws a keypress. But the keypress (character A) goes to the matlab command console window. I would like to find a way to send the keypress to the matlab figure (opened graphic window).

robot = java.awt.Robot:
pos = get(FigureH, 'Position');
set(0, 'PointerLocation', [pos(1:2)]);
robot.mousePress(java.awt.event.InputEvent.BUTTON1_MASK);
robot.mouseRelease(java.awt.event.InputEvent.BUTTON1_MASK);

java.awt.Robot.keyPress(65);

Stephane