Error using sub2ind(line43)
Afficher commentaires plus anciens
I have this code
idx = sub2ind(size(map),ygrid,xgrid)
It causes Error using sub2ind(line43) Out of range subscript.
But I check the subscripts: where size(map) gives
ans = 5 5
and
all(find(ygrid<=5 & ygrid>=1))
gives
ans = logical
1
and also
all(find(xgrid<=5 | xgrid>=1))
gives
ans = logical
1
It seems all of the subscripts I specified in ygrid and xgrid. So I don't know why the error happens.
Réponses (1)
Walter Roberson
le 26 Avr 2017
You tested
all(find(xgrid<=5 | xgrid>=1))
Your test should have been &
1 commentaire
Hao-Ming Peng
le 26 Avr 2017
Catégories
En savoir plus sur Grid Lines, Tick Values, and Labels dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!