How can I find and substract only these values from a dataset which are bigger than a threshold?
Show older comments
Hey people. I am quite new with matlab. I have a big dataset consisting of three columns (x,y,z). I would like to find x-values which are bigger than a threshold. these values i would like to substract by 360. I was thinking of a if condition sth like:
if x > 180
xnew = x - 360;
else
xnew = x;
end
This is obviously wrong. Does somebody have a advice? Thanks a lot in advance! Cheers P
Accepted Answer
More Answers (1)
the cyclist
on 5 Feb 2016
Edited: the cyclist
on 5 Feb 2016
xnew = x;
xnew(xnew>180) = xnew - 360;
2 Comments
PK
on 5 Feb 2016
the cyclist
on 5 Feb 2016
Oops, should have been
xnew = x;
xnew(xnew>180) = xnew(xnew>180) - 360;
Categories
Find more on Shifting and Sorting Matrices 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!