Code covered by the BSD License  

Highlights from
Mouse Position

4.0

4.0 | 4 ratings Rate this file 21 Downloads (last 30 days) File Size: 2.95 KB File ID: #33107

Mouse Position

by

 

get mouse position within an axes.

| Watch this File

File Information
Description

%This function works with subplots as well as individual axes in one figure
%or multiple figure,
%it requires handle to figure object that the functionality need to be
%associated with.
%multiple figure handles can be passed to it. it then finds the axes
%automatically if there are any. it returns with no error otherwise if it
%can not find at least one axes object in a vector of figure/s supplied to
%it.
%it can be set off, if varargin{2}='' or [] or {} or 'off'.
%if nargin = 1 then it asigns the functionality with all the figure/s
%supplied to it.

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
21 Dec 2011 sunshine

great

09 Nov 2011 rasam aliazizi

hey Jong:

doing it for a 3D case should not be a problem i think, although i have not found anything on websites for it...however i think i would like to do something like that and i will in soon future. thanks for the rating and comment.

06 Nov 2011 Jong Kim

Can you make 3D output. For instance, I have 3D figure. When I put mouse point at plot, it shows x, y, and z position as well.
Thanks

04 Oct 2011 peter  
04 Oct 2011 peter

thanks, will do that

04 Oct 2011 rasam aliazizi

peter, i just checked the function in matlab 2010a and it is fine if you remove narginchk, good luck.

04 Oct 2011 rasam aliazizi

yea that might be why, i just used help narginchk in matlab 010, same thing happened to me! i wrote this function using R2011b, however this is not important just get rid of it as the rest of the function checks for required inputs to be handles, figures, checks to see if a second input exists and if it is what it expects. if you are happy with the rest of the function then, removing narginchk won't change anything at all.

03 Oct 2011 peter

help narginchk

narginchk not found.

Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for methods.

I am using Matlab 2010a.

03 Oct 2011 rasam aliazizi

matlab's function, peter. help narginchk.

03 Oct 2011 peter

thanks, is this "narginchk" your own function ? or Matlab's function ?

03 Oct 2011 rasam aliazizi

peter, i do not know why you get that, all narginchk(1, 2) does is to check that user has supplied a minimum of 1 and a maximum of 2 arguments. that is it. check this on matlab help doc. however this is not important and you can comment it and get rid of it. make sure you give the right number of inputs to the function if you do. works fine on my system.

03 Oct 2011 peter

??? Undefined function or method 'narginchk' for input arguments
of type 'double'.

Error in ==> GetMousePosition at 32
narginchk(1, 2),

Error in ==> test_GetMousePosition at 26
GetMousePosition([f1, f2, f3, f4, f5, f6], 'on')

Contact us