How to change the cursor
13 views (last 30 days)
Show older comments
I have a gui form and there're axes.
When the graph has built in the axes by plot(), is it possible to set the cursor at the position of the last point of the graph?
Thank you.
7 Comments
Answers (1)
Image Analyst
on 4 Feb 2018
Here's some code to get you started with Java Robot:
import java.awt.Robot
import java.awt.event.*
mouse = Robot;
plot(1:10, 'bo-', 'LineWidth', 2);
grid on;
% ResetZoom(mouse);
% Reset the zoom so that the links will be at the same place every time.
y = 500
for x = 500 : 50 : 700
fprintf('x = %d, y = %d\n', x, y);
mouse.mouseMove(x, y);
% Set a breakpoint on the next line and wiggle your mouse to see if it put it in the right place.
% % Press the mouse button.
% mouse.mousePress(InputEvent.BUTTON1_MASK);
% mouse.mouseRelease(InputEvent.BUTTON1_MASK);
pause(0.5); % Wait at that spot for user to see it.
end
0 Comments
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!