フィルターのクリア

emptying each row of a matrix in a loop

1 回表示 (過去 30 日間)
JL
JL 2019 年 8 月 22 日
コメント済み: JL 2019 年 8 月 22 日
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;
];

採用された回答

Matt J
Matt J 2019 年 8 月 22 日
編集済み: Matt J 2019 年 8 月 22 日
a0=a;
for i=1:size(a,1)
a=a0;
a(i,:)=[],
end
  4 件のコメント
Matt J
Matt J 2019 年 8 月 22 日
a0 is the original matrix. It is available throughout the loop.
JL
JL 2019 年 8 月 22 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by