Eliminating Matrix Elements Which Exceeds Some Threshold with Using idx
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Oz Berk
el 29 de Nov. de 2019
Respondida: JESUS DAVID ARIZA ROYETH
el 29 de Nov. de 2019
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.
0 comentarios
Respuesta aceptada
JESUS DAVID ARIZA ROYETH
el 29 de Nov. de 2019
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!