⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptinput.m

📁 新的神经网络算法源程序
💻 M
字号:
function [xx,yy] = ptinput(min_nb,xx,yy)%Ptinput: Point input utility for wavenet demonstrations%%	[xx,yy] = ptinput(min_nb,xx,yy)%%	min_nb:  minimum number of inputs.	%	[xx,yy]: row vectors containing  coordiates pairs of input points%		 %	The input arguments xx,yy may be used to give some already%	defined points.%%% Use the MOUSE BUTTONS to pick points (x,y) in the graph window%%    Left   button: pick a point %    Middle button: delete a point%    Right  button: terminate input.%% Press RETURN while keeping the mouse pointer in the graph window% to terminate inputs.%	By Qinghua Zhang. March, 1994.if (nargin ~= 1) & (nargin ~= 3)   error('Number of input arguments error.');endclf; hold off; % Input Samples%===================if nargin == 1  xx = []; yy = [];elseif nargin >= 3  [xxl,xxc] = size(xx); [yyl,yyc] = size(yy);  if (xxl ~= 1) | (yyl ~= 1) | (xxc ~= yyc)    xx = [];    yy = [];  endendplot(-1, -1,'.', 1, 1, '.'); grid;title('L: pick a point, M: delete a point, R: terminate input');xlabel('x'); ylabel('y');hold on;hd1=plot(xx,yy,'o');  set(hd1, 'erase','xor');axis([-1 1 -1 1]); drawnow;while 1  [xinput,yinput,button] = ginput(1);  if (button == 13 | button==3) & (length(xx) >= min_nb)    break;  elseif (button == 13 | button==3)    disp('Too few points.');    disp('Please pick some more.');  elseif (button == 2)  % Erase a point    [d_erase1, ind_erase1] = min((xx-xinput) .^2 + (yy-yinput) .^2);        if isempty(xx) d_erase1 = 100; end         if (d_erase1 < 0.0025)      xx = xx([1:ind_erase1-1 ind_erase1+1:length(xx)]);      yy = yy([1:ind_erase1-1 ind_erase1+1:length(yy)]);    end    if d_erase1 < 0.0025      set(hd1, 'xdata',xx, 'ydata', yy); drawnow    end      end  if (abs(xinput) <= 1) & (abs(yinput) <= 1) & (button == 1)    xx = [xx xinput];    yy = [yy yinput];    if length(xx)==1      hd1=line('color','k', 'linestyle','o','erase','xor', ...               'xdata',xx, 'ydata', yy);     else      set(hd1, 'xdata',xx, 'ydata', yy);     end    drawnow;  endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -