MATLAB: Making Cumulative Difference Calculation

calculationcumulative

Hi,
I have a parameter with a column of data like this:
RunTime:
3779024.8; 3779025.8; 3779026.8; 3779027.8; 3779028.8; 3779029.8;
I want to know how I can make another parameter which calculates the cumulative difference between the values and presents it like this:
Elapsed Time:
0; 1; 2; 3; 4; 5; 6;
Thanks,

Best Answer

Not entirely sure if that's what you meant but here goes:
data = sort(rand(10,1));
cumDiff = [0;cumsum(diff(data))];
Cheers!