Depth Averaged Velocities - Nanmean higher than excluded values?!
2 views (last 30 days)
Show older comments
Hello! I am trying to get depth averaged velocities for a time series and have excluded values greater than and less than 1 and -1 in order to get accurate data. I have then taken the nanmean but my velocities are all higher (or lower) than the range I have kept. I'm really not sure what I'm doing wrong here! My code is:
u = ConVel/1000;
a = find(u>=1 & u<=-1);
u(a) = NaN;
u_av = nanmean(u);
But the vector I am left with has values <-4? Thank you for your help!
0 Comments
Accepted Answer
Steven Lord
on 13 Jul 2018
Can you give me an example of a number that is simultaneously greater than or equal to 1 and less than or equal to -1?
You want to use the or operator | instead of the and operator &.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!