MATLAB: How to create this matrix [1 2 3 4 5;2 2 3 4 5;3 3 3 4 5;4 4 4 4 5;5 5 5 5 5]

matrix manipulation

Waiting for your response

Best Answer

% data
n = 7 % "order"
% engine
x = repmat(1:n,n,1)
x = max(x, x.')
Added after comment: for non-square matrices:
n = 4 ; m = 6 ; % n-by-m matrix
x = max(repmat(1:m,n,1), repmat(1:n,m,1).')