开发者

Octave- How to find active object in axis

Matlab has a property called gco (get current object) that can be used to identify a line after mouse press.

For example:

waitforbuttonpress

handle=gco

.. do something with handle...

Octave has gcf (get curr开发者_高级运维ent figure) and gca (get current axes), but does it have a similar mechanism than Matlab's gco. Target is to manipulate lines in the axis and they are identified with mouse clicks.

BR, Antti


I'm not sure if this is what you are asking, but I know one possible workaround which at the very least could be expanded to fulfill what you are looking for. If you do:

 n = 3;
 X = 1:.1:10;
 Y1 = sin(X); Y2 = cos(X);
 plot(X,Y1); hold on; plot(X,Y2,'-r');
 [x y k] = ginput(n)

then after you click n times somewhere in the plot, you will get an output of the X and Y coordinates of where you clicked in the column vectors x, y and k will give you which mouse button was clicked at each of those locations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜