Prev: test data for neural network
Next: How can I plot two curves with two different y-axis (placed at right and left) with one reverse-logarithmic x-axis?
From: Jan on 29 Apr 2010 08:12 Dear Can anyone help me to get the coordinates of my mouse only inside an axes. I want to make an erose function with my mouse. So when I push my button I got this code: global hSeg; global axesWidth; global axesHeight; axesPositions= get(hSeg,'Outerposition'); % this don't work axesWidth = axesPositions(1,3); % this don't work axesHeight = axesPositions(1,4); % this don't work hFig = get(0,'CurrentFigure'); set(hFig,'WindowButtonMotionFcn',@moviment); set(hFig,'WindowButtonDownFcn',@moviment_down); This code I got for my moviment function: function moviment(hco,eventStruct) global hSeg; global axesWidth; global axesHeight; p = get(hSeg,'CurrentPoint'); x = p(1,1); y = p(1,2); if x >= 0 && x <= axesWidth && y >= 0 && y <= axesHeight; x y end The problem is that I get the wrong results for axesWidth and axesHeight. This means that I can only select in a small part of the axes Thanks in advance Jan
From: Matt Fig on 29 Apr 2010 12:18
See Q#29 http://www.mathworks.com/matlabcentral/fileexchange/24861-41-complete-gui-examples |