Effacer les filtres
Effacer les filtres

Adressing

1 vue (au cours des 30 derniers jours)
developer
developer le 27 Sep 2011
Hello, If i have:
A=[1 2 3 ;7 5 3;9 8 3;11 53 45]
A =
1 2 3
7 5 3
9 8 3
11 53 45
and i do
>> A(9)
ans =
3
How can i know the row and coloumn through its index value ???
Thanks

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 27 Sep 2011
help sub2ind
help ind2sub
[row,col]=ind2sub(size(A),9)
I guess you mean this:
A=[1 2 3 ;7 5 3;9 8 3;11 53 45];
[Row,Col]=find(A==9)
  3 commentaires
Fangjun Jiang
Fangjun Jiang le 27 Sep 2011
What do you mean? You can't run this?
A=magic(3);[row,col]=ind2sub(size(A),9)
Fangjun Jiang
Fangjun Jiang le 27 Sep 2011
Okay, I see! See update.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by