classify a matrix according to a "flag" value

Hello
I have a rather large matrix with 3 columns and several thousand rows (!) (1000000x3)
As example
c1 c2 c3
r1 10 -5 0
r2 20 -10 1
.. ... ... 0
rn 100 -1 0
I would like to set as my criterion the third column, if the number is 0 then collect all the information from the other two column and create a new matrix.
c1 c2 c3
r1 10 -5 0
r2 ... ... 0
rn 100 -1 0
any suggestions? thank you very much

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 19일

0 개 추천

out=A(A(:,3)==0,:)

댓글 수: 1

George
George 2013년 11월 19일
편집: George 2013년 11월 19일
thanks very much for the answer
I played around a bit and did this, perhaps it may be ok as well ?
d(:,3)==0
A=find(d(:,3)==0);
d1=d(A,1:2);

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

추가 답변 (0개)

카테고리

질문:

2013년 11월 19일

편집:

2013년 11월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by