You can use
fliplr(eye(7))
This results in
ans =
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 1 0 0 0
1 0 0 0 0
Вопрос
can you help me with this type of diagonal matrix?
| 1|
| 1 |
| 1 |
I=| 1 |
| 1 |
| 1 |
|1 |
I don't know how to do it in Matlab.
Решение
You can use
fliplr(eye(7))
This results in
ans =
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 1 0 0 0
1 0 0 0 0
Другие советы
some more options (for the sake of completeness):
rot90(eye(7))
flipud(eye(7))