How can I solve this matrix problem?

조회 수: 1 (최근 30일)
Nguyen Vinh
Nguyen Vinh 2021년 6월 4일
답변: Jonas 2021년 6월 4일

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 4일
You can start working with eye() and rot90()
Then you can try with for loop, i.e. [for .. end] and [while .. end]
  댓글 수: 1
Nguyen Vinh
Nguyen Vinh 2021년 6월 4일
Unfortunately, my teacher doesn't allow me to use rot90()

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


Jonas
Jonas 2021년 6월 4일
Use a for-loop which goes from 1:n over the two dimensions, and use an if-statement to write a 1 and an else statement to write a 0, pending on if we comply with being on that diagonal.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by