对三维空间中的一组坐标点进行范围限制。

如题,我生成了一组空间中的三维感兴趣的坐标点,但不知道怎么对这组点的范围进行限制,比如我生成的点的坐标为(x,y,z),现在要求x的坐标为(-30,30),y的坐标范围为(-30,30),z的坐标范围为(0,5),请问怎么写呢?

 Accepted Answer

brente
brente on 16 May 2023

0 votes

不用if
直接进行矩阵判断 假如num 是 N*3 的矩阵 每行是一个点的 xyz
flag=numel(:,1)>30 | numel(:,1)<-30 | numel(:,2)>30 | numel(:,2)<-30 | numel(:,3)>0 | numel(:,3)<5
得到所有不符合条件的矩阵行标记 flag
numel(flag,:)=[] 删除不合格的 就得到合格的

More Answers (0)

Categories

Find more on 矩阵和数组 in Help Center and File Exchange

Tags

Asked:

on 16 May 2023

Answered:

on 16 May 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!