Calculate mean of column in structure if another row = 1
Mostra commenti meno recenti
I have a structure that has columns Correct (either 0 or 1) and Latency. I am attempting to calculate a mean of the Latency values ONLY if correct = 1. So the Latency mean value from the data set below I am hoping to get is 402
Correct Latency
1 325
0 359
1 410
1 425
0 371
1 448
I have attempted something like this:
if struct.Correct == 1
latmean = mean(struct.Latency)
end
But I get the error "Error using == Too many input arguments"
Any thoughts on a way to achieve this? Thanks
1 Commento
Daniel
il 13 Set 2014
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Whos in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!