필터 지우기
필터 지우기

finding the position of a number?

조회 수: 1 (최근 30일)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013년 3월 27일
a=[1 2 3;4 5 6] b=2 i should compare b with all elements of a and to find the corresponding position in a ... e.g., the answer should be (1,2). what command or what method should i use

채택된 답변

Youssef  Khmou
Youssef Khmou 2013년 3월 27일
편집: Youssef Khmou 2013년 3월 27일
try this way
a=[1 2 3;4 5 6]; b=2;
[x,y]=find(a==b);
A=[x,y];
  댓글 수: 1
Image Analyst
Image Analyst 2013년 3월 27일
I wouldn't call it x,y - I'd call it row, column. Because usually x is the column (horizontal location), not the row as you have it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by