Borrar filtros
Borrar filtros

find out in which row an element is equal to a specific number

25 visualizaciones (últimos 30 días)
Locks
Locks el 1 de Mayo de 2013
Comentada: BN el 31 de Mzo. de 2020
hi,
I have the following problem:
I have a matrix with 20 columns and over 200'000 rows. somewhere in this matrix there seems to be some strange datas which I would like to delete. If I am looking for the rownumbers where the value is higher than a specific value, lets say I am looking for all the values in the first row that are larger than 1500
If I do this:
data18(:,1)>1500
I get a logical array, but what I am looking for is the exact row number, what do I need to do?

Respuesta aceptada

James Tursa
James Tursa el 1 de Mayo de 2013
Editada: James Tursa el 1 de Mayo de 2013
If you are looking for rows where any value is > 1500, then
find(any(data18>1500,2))
Or if you are only interested in rows where the 1st column is > 1500, then
find(data18(:,1)>1500)
  4 comentarios
James Tursa
James Tursa el 3 de Nov. de 2017
The 2 forces the any( ) function to work on the rows instead of the columns (which is the default).
BN
BN el 31 de Mzo. de 2020
Thank you from 2020. +1

Iniciar sesión para comentar.

Más respuestas (3)

Youssef  Khmou
Youssef Khmou el 1 de Mayo de 2013
Editada: Youssef Khmou el 1 de Mayo de 2013
hi try :
[x,y]=find(data18(:,1)>1500);

N/A
N/A el 14 de Mayo de 2016
How would you implement this in a loop for a variety of values?

partha sarkar
partha sarkar el 11 de Dic. de 2019
how to check whether aparticular value in a array is euqal to a given value

Categorías

Más información sobre Loops and Conditional Statements 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!

Translated by