Filter löschen
Filter löschen

Create upper triangular matrix using for loop in matlab

10 Ansichten (letzte 30 Tage)
Elizabeth Brito
Elizabeth Brito am 4 Jan. 2021
Kommentiert: KALYAN ACHARJYA am 4 Jan. 2021
v = 1:6;
n = round((sqrt(8 * numel(v) + 1) - 1) / 2);
M = zeros(n, n);
c = 0;
for i2 = 1:n
for i1 = 1:i2
c = c + 1;
M(i1, i2) = v(c);
end
end
I found this code to make an upper triangular matrix, but I don't understand what the code is trying to say to make it work can someone explain to me
  2 Kommentare
Elizabeth Brito
Elizabeth Brito am 4 Jan. 2021
Or could you tell me another way to make an upper triangular array with a for loop

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by