资源简介
matlab编程中,动态显示鼠标坐标值的小程序
代码片段和文件信息
function dynpoint(argh)
% Show the coordinates of a plot dynamically
%
% To start use:
% dynpoint(h)
% where h is a handle to a figure axes or e.g. line.
%
% To delete use:
% dynpoint(‘delete‘h)
% where h is a handle to a figure axes or e.g. line.
% (you may also use: dynpoint delete)
%
% There can only be one dynamic plotter in a figure at a time.
%
% Example:
% subplot(211) hline = plot(sin(1:10))
% subplot(212) plot(sin(1:100))
% dynpoint(hline)
% 20026.29
if ~exist(‘arg‘‘var‘)
arg = gcf;
end
if ~isstr(arg)
handle = arg;
arg = ‘init‘;
end
switch arg
case ‘init‘
if ~ishandle(handle)
error(‘h is not a handle‘)
end
[hax] = h2hax(handle);
% delete old dynamic text object
ht = findobj(h‘tag‘[mfilename ‘_text‘]);
if any(ht)
delete(ht)
end
% text window at the bottom left corner
% text in centred
uicontrol(h...
评论
共有 条评论