Mean value of two variables from an array with less than condition.
Show older comments
if mean(x(2:end,1),x(1:end-1,1)) < 0.01
do something;
end
For some cases my mean value is actually 0.01 but it is still going into the loop. I am not sure why. I have also tried lt(mean(x(2:end,1),x(1:end-1,1)),0.01) but it is still not working for me.
Thank you in advance for your help.
1 Comment
Geoff Hayes
on 18 Jul 2019
Manan - are you sure that your mean is actually 0.01 or is that just how the value that is displayed? See Set Command Window output display format for details.
Also, is
mean(x(2:end,1),x(1:end-1,1))
valid? Can you pass two arrays as inputs to the mean function?
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays 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!