how to clean data by deleting [0 0]

조회 수: 1 (최근 30일)
abdullah al-dulaimi
abdullah al-dulaimi 2022년 6월 30일
편집: Jonas 2022년 6월 30일
I have a data AB=[1 2
3 4
5 6
0 7
8 0
0 0
9 0
0 10
0 0]
I want to delete [0 0], so the result will be
[1 2
3 4
5 6
0 7
8 0
9 0
0 10]

채택된 답변

Jonas
Jonas 2022년 6월 30일
편집: Jonas 2022년 6월 30일
use
rowsToDelete=~any(AB,2);
or
rowsToDelete=all(~AB,2);
AB(rowsToDelete,:)=[];
or
rowsToKeep=any(AB,2);
AB=AB(rowsToKeep,:);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by