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

Jan
Jan 2018년 2월 4일
There is no "cursor" in axes objects- So please mention, what you mean.
per isakson
per isakson 2018년 2월 4일
편집: per isakson 2018년 2월 4일
Doc says: PointerLocation — Current location of pointer, specified as a two-element vector of the form [x y]. ... Move the pointer by changing the values of this property.
@Jan, You are correct, the text is copied from Root Properties, Graphics environment and state information. (I removed the string "[Figure.]" to avoid causing more confusion.)
Furthermore, it takes some programming to use PointerLocation to "to set the cursor at the position of the last point of the graph".
Jan
Jan 2018년 2월 4일
@per: Ah, the position of the mouse cursor. But which documentation mentions "[Figure.]PointerLocation"? The groot object has such a property, but not the figures.
Image Analyst
Image Analyst 2018년 2월 4일
It's not easy but it can be done with java.robot. Moving the mouse is trivial enough - it's the determining where on the screen that the last data point was plotted that is the hard part.
Walter Roberson
Walter Roberson 2018년 2월 4일
The figure property is named CurrentPoint
Jan
Jan 2018년 2월 4일
@Image Analyst: getpixelposition helps.
Jan
Jan 2018년 2월 4일
@Kirill: It is still not clear, which "cursor" you mean.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2018년 2월 4일

0 개 추천

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

카테고리

질문:

2018년 2월 3일

댓글:

Jan
2018년 2월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by