How can i find deleted rows from matrix??

1 Ansicht (letzte 30 Tage)
Triveni
Triveni am 9 Mär. 2016
Kommentiert: Stephen23 am 9 Mär. 2016
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.

Akzeptierte Antwort

KSSV
KSSV am 9 Mär. 2016
use k = x0(any(x0<2,2),:) ;
k will be your matrix which you are going to delete.
  4 Kommentare
Stephen23
Stephen23 am 9 Mär. 2016
Bearbeitet: Stephen23 am 9 Mär. 2016
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 am 9 Mär. 2016
I already answered this in your other question.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by