필터 지우기
필터 지우기

Find given element in column 1 with "find" function.

조회 수: 3 (최근 30일)
Navya Snigdha Thumma
Navya Snigdha Thumma 2015년 7월 24일
댓글: bio lim 2015년 7월 24일
Hello all, I am trying to use "find" function and I want to find the given number in 1st column only. For example if I have a matrix A= [ 1 1 3;1 2 3;1 2 1]; and I want to find 1's in column 1 by using P=find(A==1). My ans is P= [1;2;3;4;9] which are the indexes of 1. I want only 1st column output which should be [1;2;3]. Please help if you have any idea. Thank you.

채택된 답변

bio lim
bio lim 2015년 7월 24일
편집: bio lim 2015년 7월 24일
A = [ 1 1 3;1 2 3;1 2 1];
P = find(A(:,1)==1);
  댓글 수: 2
Navya Snigdha Thumma
Navya Snigdha Thumma 2015년 7월 24일
편집: Navya Snigdha Thumma 2015년 7월 24일
Thankyou very much. It worked.
bio lim
bio lim 2015년 7월 24일
Glad to help. :)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by