필터 지우기
필터 지우기

emptying each row of a matrix in a loop

조회 수: 2 (최근 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.

댓글을 달려면 로그인하십시오.

추가 답변 (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