How to fast create a specific matrix

I want to generate a matrix with the same pattern but different size.
pattern: for a matrix with size [4 4]
[ 0 0 0 0;
0 0 0 1;
0 0 1 2;
0 1 2 3]
The matrix is always square. The size is often more than 256 in practice. I can generate this kind of matrix using for-loop. But it's too slow.
How to fast create this kind of matrix?

 Accepted Answer

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 21 Jun 2019

Commented:

on 21 Jun 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!