how to get value except one row which in_zone value is 2

2 visualizzazioni (ultimi 30 giorni)
in_zone IDX X0 Y0
1.0000 6.0000 63.0726 15.1375
2.0000 7.0000 36.0104 61.2907
3.0000 7.0000 33.9572 63.7608
4.0000 1.0000 79.5694 33.8963
5.0000 4.0000 32.1705 3.3693
6.0000 6.0000 61.7462 2.7168
7.0000 6.0000 47.1972 4.5858
8.0000 4.0000 28.2593 6.1512
10.0000 2.0000 59.0526 96.3679
11.0000 3.0000 8.0508 71.4797
12.0000 3.0000 25.6312 77.2386
14.0000 6.0000 56.0307 9.7606
15.0000 5.0000 20.2091 28.1303
16.0000 2.0000 51.2369 88.3358
19.0000 1.0000 75.2368 36.6786
20.0000 5.0000 8.0068 29.2302
23.0000 2.0000 58.7110 69.8019
25.0000 7.0000 35.0651 45.3938
28.0000 2.0000 47.3280 80.1042
30.0000 3.0000 33.4992 80.5353
ch =2
cl1=7
2.0000 36.0104 61.2907
3.0000 33.9572 63.7608
25.0000 35.0651 45.3938
Now I get all value from column 1(in_zone),3(X0),4(Y0) which contain 7 in 2(IDX) column
but I get all value except ch value and its corresponding values.
now wish to get only
3.0000 33.9572 63.7608
25.0000 35.0651 45.3938

Risposta accettata

the cyclist
the cyclist il 28 Apr 2015
Now I understand your question better. Here is how to do it in one line:
A = XY1(XY1(:,1)~=ch & XY1(:,2)==cl1,[1,3,4])
Here is the same thing done is multiple steps:
% Index to values where first column is _not_ equal to _ch_:
idx1 = XY1(:,1)~=ch;
% Index to values where second column _is_ equal to _cl1_:
idx2 = XY1(:,2)==cl1;
% Index to values where _both_ conditions are true:
idx_both = idx1 & idx2;
% Use the index to get the rows:
A = XY1(idx_both,[1,3,4])

Più risposte (1)

the cyclist
the cyclist il 27 Apr 2015
A(not(A(:,1)==2),:)
  1 Commento
singh
singh il 28 Apr 2015
cyclist firstly A filter those value which hold cl1 in IDX and now i wish to again filter the first column of result A and who has contain ch value in first column except whole row and get the rest data.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by