Eliminating Matrix Elements Which Exceeds Some Threshold with Using idx

13 ビュー (過去 30 日間)
Oz Berk
Oz Berk 2019 年 11 月 29 日
回答済み: JESUS DAVID ARIZA ROYETH 2019 年 11 月 29 日
I am working on a Radon transform algorithm, in my code i have a set of x,y values and i wanted to eliminate the x,y values which exceeds some certain values like -2 and 2 for example. For this purpose, i am using the code below but i couldn't get how it works. Is there anyone who can explain to me?
idx=any(A<-M/2 | A>M/2,2);
out=A(idx,:);
A(idx,:)=[];
Thanks in advance.

採用された回答

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 29 日
A is a Matrix of m rows by n columns, therefore, idx is going to be a logical vector of m rows by 1 column, if any element in the row of A is less than -M / 2 or greater than M / 2 then in that row the idx value will be 1 otherwise it will be 0.
in out those rows of A that were positive in idx are going to be saved and from those rows we want to get all the columns, and after that in those same rows that were 1 with A (idx,:) = []; what is done is to eliminate them and have a new Matrix of A without those rows.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by