MATLAB: Add zero rows to a matrix

matrix array

Hi, I have the matrix A:
A=[1 5;
2 4;
4 9;
6 3;]
All the elements of the 1st column are integer and arranged ascendingly but there is a jump somewhere (from row 2 to 4 missing 3 and from 4 to 6 missing 5). I want to add zero rows wherever there is jump in the 1st column to become:
A=[1 5;
2 4;
0 0;
4 9;
0 0;
6 3;]
Thanks in advance

Best Answer

A=[1 5; 2 4; 4 9; 6 3]
A(logical(accumarray(A(:,1),1)),:)=A