日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

matlab 鼠标画图,在matlab中使用鼠标在GUI上绘图

發(fā)布時間:2024/3/12 循环神经网络 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab 鼠标画图,在matlab中使用鼠标在GUI上绘图 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

最后我找到了一個很好的代碼,我已經(jīng)為我自定義了一些部分.通過這種方式,用戶可以使用鼠標(biāo)在軸上繪制任何東西:

function userDraw(handles)

%F=figure;

%setptr(F,'eraser'); %a custom cursor just for fun

A=handles.axesUserDraw; % axesUserDraw is tag of my axes

set(A,'buttondownfcn',@start_pencil)

function start_pencil(src,eventdata)

coords=get(src,'currentpoint'); %since this is the axes callback, src=gca

x=coords(1,1,1);

y=coords(1,2,1);

r=line(x, y, 'color', [0 .5 1], 'LineWidth', 2, 'hittest', 'off'); %turning hittset off allows you to draw new lines that start on top of an existing line.

set(gcf,'windowbuttonmotionfcn',{@continue_pencil,r})

set(gcf,'windowbuttonupfcn',@done_pencil)

function continue_pencil(src,eventdata,r)

%Note: src is now the figure handle, not the axes, so we need to use gca.

coords=get(gca,'currentpoint'); %this updates every time i move the mouse

x=coords(1,1,1);

y=coords(1,2,1);

%get the line's existing coordinates and append the new ones.

lastx=get(r,'xdata');

lasty=get(r,'ydata');

newx=[lastx x];

newy=[lasty y];

set(r,'xdata',newx,'ydata',newy);

function done_pencil(src,evendata)

%all this funciton does is turn the motion function off

set(gcf,'windowbuttonmotionfcn','')

set(gcf,'windowbuttonupfcn','')

總結(jié)

以上是生活随笔為你收集整理的matlab 鼠标画图,在matlab中使用鼠标在GUI上绘图的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。