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

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 日

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 日

0 投票

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 日

0 投票

very thank you @wayne king and @azzi abdelmalek for your answer, that was very help me:)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

質問済み:

nu
2013 年 12 月 1 日

回答済み:

nu
2013 年 12 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by