フィルターのクリア

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 Center および File ExchangeLanguage Fundamentals についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by