how to clean data by deleting [0 0]

1 次查看(过去 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 中查找有关 Get Started with MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by