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

9 visualizaciones (últimos 30 días)
nu
nu el 1 de Dic. de 2013
Respondida: nu el 1 de Dic. de 2013
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..?

Respuesta aceptada

Wayne King
Wayne King el 1 de Dic. de 2013
Editada: Wayne King el 1 de Dic. de 2013
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"

Más respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 1 de Dic. de 2013
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 el 1 de Dic. de 2013
very thank you @wayne king and @azzi abdelmalek for your answer, that was very help me:)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by