필터 지우기
필터 지우기

Extract data from columm

조회 수: 1 (최근 30일)
Quynh tran
Quynh tran 2017년 6월 9일
댓글: Quynh tran 2017년 6월 9일
Dear all,
Could you help me? I have this matrix:
A= [1 3 0
2 0 0
3 0 0
4 3 0
5 0 0
6 0 0
7 0 0
8 0 0
9 0 0
10 3 0
11 0 0
12 0 0
13 5 0
14 0 0
15 0 0
16 0 0
17 6 0
18 0 0
19 0 0
20 0 0
21 3 0
22 0 0
23 0 0
24 6 0
25 0 0
26 0 0
27 0 0
28 0 0
29 0 0
30 0 0
31 0 0
32 0 0.02256
33 0 0.018682
34 4 0.011892
35 0 0.022345
36 3 0.018794
37 0 0.021655
38 0 0.015674
39 0 0.023075
40 0 0.01055
41 0 0.013921
42 3 0.017497
43 0 0.023766
44 0 0.005467
45 0 0.011991
46 0 0.020437
47 0 0.022869
48 0 0.014035
49 0 0.023253
50 0 0.019731
51 0 0.019275
52 0 0.012172
53 0 0.010395
54 0 0.01569
55 0 0.014506
56 0 0.011423]
I want to extract a submatrix which have number 0 in the columm 3. The result will be
B=[1 3 0
2 0 0
3 0 0
4 3 0
5 0 0
6 0 0
7 0 0
8 0 0
9 0 0
10 3 0
11 0 0
12 0 0
13 5 0
14 0 0
15 0 0
16 0 0
17 6 0
18 0 0
19 0 0
20 0 0
21 3 0
22 0 0
23 0 0
24 6 0
25 0 0
26 0 0
27 0 0
28 0 0
29 0 0
30 0 0
31 0 0]
and another submatrix which have all range with number 3 in the second columm. The results will be:
C= [1 3 0
4 3 0
10 3 0
21 3 0
36 3 0.018794
42 3 0.017497].
Thanks.

채택된 답변

KSSV
KSSV 2017년 6월 9일
편집: KSSV 2017년 6월 9일
A is your matrix:
%%Number 0 in col3
B = A(A(:,3)==0,:) ;
%%Number 3 in col2
C = A(A(:,2)==3,:) ;
  댓글 수: 1
Quynh tran
Quynh tran 2017년 6월 9일
Thank you so much

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

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