emptying each row of a matrix in a loop

1 Ansicht (letzte 30 Tage)
JL
JL am 22 Aug. 2019
Kommentiert: JL am 22 Aug. 2019
Is there a way to empty each row of a matrix in a loop? For example
a = [1 2;
1 3;
1 5;
1 7;
1 8;];
first loop
a = [
1 3;
1 5;
1 7;
1 8;];
second loop
a = [1 2;
1 5;
1 7;
1 8;];
and so on until the last loop
a = [1 2
1 3;
1 5;
1 7;
];

Akzeptierte Antwort

Matt J
Matt J am 22 Aug. 2019
Bearbeitet: Matt J am 22 Aug. 2019
a0=a;
for i=1:size(a,1)
a=a0;
a(i,:)=[],
end
  4 Kommentare
Matt J
Matt J am 22 Aug. 2019
a0 is the original matrix. It is available throughout the loop.

Melden Sie sich an, um zu kommentieren.

Weitere 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