How make this matrix using for loop?

1 Ansicht (letzte 30 Tage)
Jeong_evolution
Jeong_evolution am 20 Sep. 2017
Kommentiert: Jeong_evolution am 20 Sep. 2017
-1 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0
-1 -1 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0
-1 -1 -1 0 0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0 0 0 0 0
-1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0 0 0 0
-1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0 0

Akzeptierte Antwort

Stephen23
Stephen23 am 20 Sep. 2017
Why use a loop?
>> M = zeros(10,14);
>> M(1:2:end,1:5) = -tril(ones(5));
>> M(2:2:end,1:5) = +tril(ones(5));
  1 Kommentar
Jeong_evolution
Jeong_evolution am 20 Sep. 2017
excellent. thanks..
I think just use for loop...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 루프와 조건문 finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!