Problem 1850. Create a matrix with difference of each row of input matrix

With a given input matrix A, create a output matrix B in such a way that each row in B is a difference of rows of input matrix A.

e.g A = [1 2 3; 7 8 9; 10 40 60;]

Then B = [6 6 6; %difference between row#2 and row #1 3 32 51; %difference between row#3 and row #2 -9 -38 -57;] %difference between row#1 and row #3

Solution Stats

80.7% Correct | 19.3% Incorrect
Last solution submitted on Oct 31, 2016
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more