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

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

 채택된 답변

brente
brente 2023년 5월 16일

0 개 추천

不用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,:)=[] 删除不合格的 就得到合格的

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 矩阵和数组에 대해 자세히 알아보기

태그

질문:

2023년 5월 16일

답변:

2023년 5월 16일

Community Treasure Hunt

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

Start Hunting!