www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DifferencesBetweenMatrixRowsExample.m

    %% Differences Between Matrix Rows  

%% 
% Create a 3-by-3 matrix, then compute the first difference between the
% rows.
X = [1 1 1; 5 5 5; 25 25 25];
Y = diff(X) 

%%
% |Y| is a 2-by-3 matrix.