Setting threshold on a matrix

5 ビュー (過去 30 日間)
arun Dhillon
arun Dhillon 2019 年 4 月 9 日
コメント済み: arun Dhillon 2019 年 4 月 9 日
Hello Everyone
Please help me with the following problem.
I have an n*3 matrix, for instance the values in the matrix(m) are
m=
123 256 0.112
231 256 0.081
321 242 0.091
222 242 0.213
Further all the values should stay always with respect to each other, because the first column refers to x coordinates , the second one refers to y coordinates and third one
is like a weight asscociated to that particular object on any x,y coordinates.
So is there a way in which I can set a threshold on 3rd column such that in matrix m, all the values that are less than 0.092 should be ignored or removed from the matrix m, and also the coresponding
values in column 2 and column 1 should be removed as well. So in the matrix m 2nd and 3rd row should be removed and the new matrix will be a 2*3 matrix. Please help me with the same.

採用された回答

madhan ravi
madhan ravi 2019 年 4 月 9 日
m(m(:,3)<.092,:)=[]
  2 件のコメント
arun Dhillon
arun Dhillon 2019 年 4 月 9 日
Thanks a lot
madhan ravi
madhan ravi 2019 年 4 月 9 日
編集済み: madhan ravi 2019 年 4 月 9 日
@arun Dhillon the answer that you accepted assumes less than or equal to whereas your question states less than

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2019 年 4 月 9 日
編集済み: KSSV 2019 年 4 月 9 日
Let A be your m*3 matrix.
A(A(:,3)<=0.092,:) = [] ; % remove rows from A where third column is less than or equal 0.092
  1 件のコメント
arun Dhillon
arun Dhillon 2019 年 4 月 9 日
Thank you.
It works very well

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by