Delete rows from cell array in a for loop
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi, I want to delete one row in each iteration in a for loop. For example in iteration 1 I want to delete row 1, in iteration 2 I want to delete row 2 but I want to have row 1 in my cell array, in iteration 3 I want to delete row 3 but I want to have row 2 and 3 in my cell array. How can I do it?
댓글 수: 2
Jan
2022년 10월 24일
Is this a typo: "delete row 3 but I want to have row 2 and 3"? Do you mean row 1 and 2?
채택된 답변
추가 답변 (1개)
David Hill
2022년 10월 24일
for k=1:100
a=yourCell;%just copy yourCell to another variable
a(k,:)=[];%deletes row k
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!