MATLAB: Alternative to diff(X)

arrayfundiff()gpu

Hi there, is there anyother 1 line method to diff(X), as diff is not supported in the gpu arrayfun!
Thanks

Best Answer

x = 1:10;
x(2:end)-x(1:end-1)