MATLAB: The difference in an array

finding the difference in values

Best Answer

sum(abs(diff([5 3 6 1 5 1 6 7 3])))