How to obtain the absolute difference between elements in a row?

33 次查看(过去 30 天)
Hi I have
a= 4 3 2 1
4 3 1 2
4 2 3 1
I want to know the absolute difference between elements for each of the rows which gives me
b= 1 1 1
1 2 1
2 1 2
How am I going to do this? Thank you.

采纳的回答

Guillaume
Guillaume 2014-8-17
编辑:Guillaume 2014-8-17
b = abs(diff(a, 1, 2))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by