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

📄 extractpoly.m

📁 麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!
💻 M
字号:
function [xc,yc,xh,yh,nanindx] = extractpoly(xp,yp)
%EXTRACTPOLY  Extract contour and holes from polygon element.
%   [XC,YC,XH,YH,NANINDX] = EXTRACTPOLY(XP,YP) extracts the contour and
%   holes data from a polygon element.

%  Written by:  A. Kim
%  Copyright 1996-2002 Systems Planning and Analysis, Inc. and The MathWorks, Inc.
%  $Revision: 1.3 $    $Date: 2002/03/20 21:26:45 $

% convert data to matrix
if iscell(xp)
	xp = xp{1};  yp = yp{1};
end

% append a nan at the end
x = [xp; nan];  y = [yp; nan];
indx = find(isnan(x));

% contour
indxc = 1:indx(1)-1;
xc = x(indxc);  yc = y(indxc);

% holes
xh = [];  yh = [];  nanindx = [];
if length(indx)>1
	indxh = indx(1):indx(end);
	xh = x(indxh);  yh = y(indxh);
	nanindx = find(isnan(xh));
end

⌨️ 快捷键说明

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