emptying each row of a matrix in a loop

1 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by