Say I have a matrix [1:1:10], and I would like to add(or subtract) the first value with the second value. And I want Matlab to repeat this for all values within the matrix. i.e. 1+2, 2+3, 3+4 and so on, until 9+10. I imagine that the code has to use i and i+1, where i is any given value within my matrix. But how do I write this down in my script? Any ideas are appreciated.
MATLAB: How to add or subtract any given matrix value with its following value
matrix manipulation
Related Question
- How to vectorize vector indexing
- Insert NaNs (or any value) in several position of a vector
- If this value of 5×5 cell with vectors [106×1] are different to zeroes,count them e put the count in a matrix.
- Find all numeric values right after the NaN values in a column vector
- How to use the values in a vector to use/represent the indices of another vector or matrix
Best Answer