MATLAB 帮助中心
确定 polyshape 边界是否为孔
polyshape
TF = ishole(polyin)
TF = ishole(polyin,I)
如果 polyin 有边界是孔,则 TF = ishole(polyin) 返回对应元素为 1 (true) 的逻辑向量。
polyin
TF
true
示例
TF = ishole(polyin,I) 返回与 I 索引的 polyin 边界对应的逻辑向量。TF 与 I 的长度相同。
I
全部折叠
创建包含一个实心区域和一个孔的多边形,并确定哪个区域是孔。
t = 0.05:0.5:2*pi; x1 = cos(t); y1 = sin(t); x2 = 0.5*cos(t); y2 = 0.5*sin(t); polyin = polyshape({x1,x2},{y1,y2})
polyin = polyshape with properties: Vertices: [27×2 double] NumRegions: 1 NumHoles: 1
plot(polyin)
TF = 2×1 logical array 0 1
要一次查询一个边界,请使用边界索引作为第二个参量。
TF = ishole(polyin,2)
TF = logical 1
输入 polyshape,指定为标量。
数据类型: polyshape
边界索引,指定为整数标量或由整数组成的向量。I 的每个元素对应于输入 polyshape 的一个边界。
数据类型: double | single | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
double
single
int8
int16
int32
int64
uint8
uint16
uint32
uint64
全部展开
用法说明和限制:
必须启用动态内存分配才能进行代码生成。
名称-值对组必须为编译时常量。
在 R2017b 中推出
polyshape | holes
holes
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处