SIZE Matrix dimensions. D = SIZE(X), for M-by-N matrix X, returns the two-element row vector D = [M, N] containing the number of rows and columns in the matrix. [M,N] = SIZE(X) returns the number of rows and columns in separate output variables. M = SIZE(X,1) returns just the number of rows. N = SIZE(X,2) returns just the number of columns.