How do I combine these answers into a matrix?

1 view (last 30 days)
Here is the code I have.
A=[1;13;15;20;23;27];
for k=2:6;
[index_diff]=A(k,1)-A(k-1,1)
end
I would like to put the answers (12,2,5,3,4) into a 5 by 1 matrix. How do I do this?

Accepted Answer

Adam
Adam on 30 Jan 2019
diff(A)
will do this.

More Answers (0)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!