-
大小: 2KB文件類型: .m金幣: 1下載: 0 次發(fā)布日期: 2021-06-01
- 語言: Matlab
- 標(biāo)簽:
資源簡介
matlab編程中,動(dòng)態(tài)顯示鼠標(biāo)坐標(biāo)值的小程序
代碼片段和文件信息
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(‘a(chǎn)rg‘‘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...?
評(píng)論
共有 條評(píng)論