find arrays that are consecutively equal
Show older comments
suppose i have a vector W(idx) = [ ........ 1 4 3 6 7 4 2 6 0 0 0 0 20 6 15 2 3 0 0 0 0 31...... ]
I want to find arrays that have:
- z-score value higher than 3,
- have a value over 15.
- its previous arrays should have at least three times consecutively same value of 0
With the provided exmple vector W(idx), the idx-points that meet above mentioned specifications would be points that has 20 and 31 as W-value.
I have written the first 1 & 2 specifications, but can't figure how to implement the #3.
stdDev = std(W(idx))
meanValue = mean(W(idx))
zFactor = 3 % arbitrary value to filter only outlier with huge value (usually, z factor of 3 -> outlier)
outliers_1 = find((abs(W(idx)-meanValue) > (zFactor * stdDev)) & (W(idx) > 20) )
#3 --> the final outlier's previous arrays should have at least three consecutive value of 0
Maybe in a similar way like this?
outlier = find(W(outliers_1 - 1) == W(outliers_1 -2) == W(Outliers_1 - 3) == 0)
Please help me out how to find arrays that have consecutively 0 before previously stated outlier_1 position
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!