Making Cumulative Difference Calculation
Show older comments
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,
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 16 Aug 2012
Edited: Azzi Abdelmalek
on 16 Aug 2012
A=[3779024.8; 3779025.8; 3779026.8; 3779027.8; 3779028.8; 3779029.8];
result=[0 ;cumsum(diff(A))];
disp('elapsed time');disp(sprintf('%d;',result))
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!