How do I find where my data point pairs satisfy both conditions?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a table with two columns and over 3000 rows. I am trying to find at how many points do these two columns satisfy a condition.
For example, I have Column1 and Column2, and I want to know where Column1 or Column2 has a value of X or Y (can be interchangeable).
I believe that I want to do something similar to the excel function COUNTIFS, since I have two conditions that I want to satsify, however I am haveing trouble using "groupcounts" on MATLAB
1 commentaire
the cyclist
le 3 Nov 2022
Your question is not very clear, at least to me.
In addition to describing what you need, I suggest you write out a small example of input and desired output.
Réponses (1)
Image Analyst
le 3 Nov 2022
Assuming t is your table and your fields are called Column1 and Column2, and are integers you can do
rowsSatisfyingCondition = (t.Column1 == X) & (t.Column2 == Y);
numRows = sum(rowsSatisfyingCondition);
See the FAQ: https://matlab.fandom.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_(or_similar)_not_equal_to_zero?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
0 commentaires
Voir également
Catégories
En savoir plus sur Logical 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!