From a large single column set of data, how can I get the differences between data points above and below each other?

I have this problem whereby i need to find the difference between a single column set of data. For example, datapoint1-datapoint2...datapoint2-datapoint3...datapoint3-datapoint4 and so on for 170 data points. I want to find a way in which i can display these differences in a vector without having to tediously write every single data point subtraction.

Answers (2)

While I prefer Andrei's suggestion (why does it not help you?), what about this:
result = datapoint(1:end - 1) - datapoint(2:end)

This question is closed.

Products

Asked:

on 17 May 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!