How can i find deleted rows from matrix??

1 次查看(过去 30 天)
x0 = [2 3 2 2 2;
2 3 2 2 2;
2 4 1 2 2;
2 4 1 2 2;
2 3 2 2 2;
2 3 2 2 2];
x0(any(x0<2,2),:) = [];
x0 = [2 3 2 2 2;
2 3 2 2 2;
2 3 2 2 2;
2 3 2 2 2];
I want to see deleted row separately i.e
2 4 1 2 2;
2 4 1 2 2;
I want to know index of x0 which deleted.

采纳的回答

KSSV
KSSV 2016-3-9
use k = x0(any(x0<2,2),:) ;
k will be your matrix which you are going to delete.
  4 个评论
Stephen23
Stephen23 2016-3-9
编辑:Stephen23 2016-3-9
Save the index and use it:
>> idx = any(x0<2,2);
>> xdel = x0(idx,:)
xdel =
2 4 1 2 2
2 4 1 2 2
>> xnew = x0(~idx,:)
xnew =
2 3 2 2 2
2 3 2 2 2
2 3 2 2 2
2 3 2 2 2

请先登录,再进行评论。

更多回答(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