nanmean problem (bachelor thesis help!)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
D.T. van der Meulen
am 31 Mai 2015
Kommentiert: Image Analyst
am 2 Jun. 2015
Hi!
I'm writing a script where I'm analysing gait data. I calculated the stride velocity by dividing stride length by stride time and it gives me the velocityL vector with some NaN where the SD is greater than 2 times the mean.
Now I wanna delete any wrong values that were created by calculating the velocityL. Because there are NaN is the vector, I used nanmean:
% %remove wrong values
% VelocityL(VelocityL>(nanmean(VelocityL)+SD*nanstd(VelocityL)))= NaN;
However, matlab says that nanmean(VelocityL) is inferior, so the script above won't work.
Does anyone know the solution to my problem?
Thanks in advance! Rik
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 31 Mai 2015
All your code is in comments so it won't generate any error at all. And, what is the value of SD? Is it 2? What is the values in VelocityL? Without these we can't run your code and recreate your error. You didn't even paste in the error so we don't know what it said. Please copy and paste in all the red text that you see from the error message back here so we can decipher it.
2 Kommentare
Image Analyst
am 2 Jun. 2015
VelocityL = [...
Inf
3.56453829563124
NaN
NaN
NaN
NaN
NaN
NaN
0.409564278065197
0.557640201673890
NaN
0.614743629694066
0.685943864947752
0.788112282608062
0.731369659147766
0.861933814298274]
% Remove inf from the array.
VelocityL(VelocityL== inf) = [];
% Now get means of non-nan values.
meanV = nanmean(VelocityL)
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!