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

如题,我生成了一组空间中的三维感兴趣的坐标点,但不知道怎么对这组点的范围进行限制,比如我生成的点的坐标为(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!