How do I find where my data point pairs satisfy both conditions?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
the cyclist
il 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.
Risposte (1)
Image Analyst
il 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 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!