is anyone know, how to know the matrix coordinate..?

9 ビュー (過去 30 日間)
nu
nu 2013 年 12 月 1 日
回答済み: nu 2013 年 12 月 1 日
is anyone know, how to know the matrix coordinate..?
a = [1 1 0; 0 0 0; 0 0 1;];
1 have coordinate on, (1,1) (1,2) and (3,3)
how to know the matrix coordinate..?

採用された回答

Wayne King
Wayne King 2013 年 12 月 1 日
編集済み: Wayne King 2013 年 12 月 1 日
a = [1 1 0; 0 0 0; 0 0 1;];
idx = find(a==1); % linear coordinates
[I,J] = ind2sub(size(a),idx);
The I,J pairs are the "matrix coordinates"

その他の回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 1 日
In your case, you have only 1 and 0
a = [1 1 0; 0 0 0; 0 0 1;];
[ii,jj]=find(a)

nu
nu 2013 年 12 月 1 日
very thank you @wayne king and @azzi abdelmalek for your answer, that was very help me:)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by