Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在运行程序的窗口底部运行 C 或 Matlab 程序来移动鼠标,例如使用图像处理来移动鼠标指针。如何使用一组代码移动鼠标以及如何单击左右?
您可以很容易地直接从 Matlab 中使用 Java Robot 类;就像是:
robot = javaObjectEDT('java.awt.Robot'); robot.mouseMove(100, 200); robot.mousePress(16); robot.mouseRelease(16);
mousePress 和 mouseRelease 的参数是来自 InputEvent 的常量值。您可以在此处找到它们的值,此处的文档会告诉您使用哪些常量(例如 BUTTON1_MASK 或左键单击为 16)。