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

조회 수: 10 (최근 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 CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by