How can i find deleted rows from matrix??

조회 수: 1 (최근 30일)
Triveni
Triveni 2016년 3월 9일
댓글: Stephen23 2016년 3월 9일
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
Stephen23
Stephen23 2016년 3월 9일
I already answered this in your other question.

댓글을 달려면 로그인하십시오.

추가 답변 (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