Creating a stepped pattern of zeros in an array

Hello all,
I was hoping if anyone knows of a way to create the 'A' matrix consisting of 1s and 0s as shown below. I need to create a very large version of this example and was hoping to accomplish this without the use of loops.
A =
1 1 1 1
1 1 1 0
1 1 0 0
1 0 0 0
Thank you in advance for any help or tips,
Chris

 채택된 답변

madhan ravi
madhan ravi 2019년 4월 3일

0 개 추천

flip(tril(ones(4)))

댓글 수: 1

Perfect!
Thank you so much for your answer and very prompt response.
-Chris

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2019년 4월 3일

댓글:

2019년 4월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by