Outputting how far down a set of data a set of numbers are in a large data set

8 vues (au cours des 30 derniers jours)
Hi everyone,
Could I get some help on this, I have a large data set of a random set of data, 100x7 in a identity called v, I want to find all the numbers which are equal to or less than 2 in this set, but i dont want it to outut the value of these numbers, but to output the row on which those values are found on. At the moment i get answers ranging between 1-700 using the find function within matlab. Where I want the outputs to only be ranging from 1-100, as there is in essence 100 rows that these values can be found.
In short I want to find a program which outputs the row number which numbers only suiting my conditions lie on, as opposed to the position they fall in, for a data set of 700 numbers. Preferably I want the function to include a loop/if condition if possible
Many thanks,
Ethan
  1 commentaire
Rik
Rik le 10 Nov 2020
Edit restored from Google cache.
Don't edit away your question, that is extremely rude.

Connectez-vous pour commenter.

Réponse acceptée

Kelly Kearney
Kelly Kearney le 10 Nov 2020
If you supply 2 outputs to find, it will return the row and column indices corresponding to each true element:
[rowidx, colidx] = find(data < 2);
  2 commentaires
Et.B200
Et.B200 le 10 Nov 2020
Modifié(e) : Et.B200 le 10 Nov 2020
Thats brill, but what if you just wanted the rowidx to be set to a element and outputted? Also how would you remove any repeat rowidx values if they appear more than once?
Kelly Kearney
Kelly Kearney le 10 Nov 2020
Take a look at the unique function to remove repeats. Not quite sure what you mean by the other part of your question.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Google dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by