how to clean data by deleting [0 0]

1 Ansicht (letzte 30 Tage)
abdullah al-dulaimi
abdullah al-dulaimi am 30 Jun. 2022
Bearbeitet: Jonas am 30 Jun. 2022
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]

Akzeptierte Antwort

Jonas
Jonas am 30 Jun. 2022
Bearbeitet: Jonas am 30 Jun. 2022
use
rowsToDelete=~any(AB,2);
or
rowsToDelete=all(~AB,2);
AB(rowsToDelete,:)=[];
or
rowsToKeep=any(AB,2);
AB=AB(rowsToKeep,:);

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by