Problem using shapefile in matlab
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm working with the free m_map toolbox for the first time. I would like to overlay an image with a vector (shape file) "clip" by doing this:
M=m_shaperead('clip');
clf;
for k=1:length(M.ncst),
line((M.ncst{k}(:,1)),M.ncst{k}(:,2));
end;
I got the following message:
Subscript indices must either be real positive integers or logicals.
Error in carta4 (line 5)
line((M.ncst{k}(:,1)),M.ncst{k}(:,2));
these are simple positive lat/lon values, for example: 13.2130 17.2304, even when transforming these values to integer ( 13210 17230) the error persists, could someone explain me which is the easiest way of reading shapefiles with the m_map toolbox?
Thank you very much
0 commentaires
Réponses (2)
Kelly Kearney
le 12 Juin 2014
I don't see anything wrong with that code, and substituting another shapefile works fine. Can you show us the details of M?
Are you sure you copied your code correctly? The error isn't in the shapefile read, but rather in the plotting line. It seems to indicate that k isn't an integer, but I'm not sure how that could occur.
On a side note, you seem to have an extra set of parentheses in there (around M.ncst{k}(:,1)), but again I don't think that would cause any issues.
0 commentaires
Jose Luis
le 12 Juin 2014
1 commentaire
Kelly Kearney
le 12 Juin 2014
Okay, that all looks fine. What is the value of k when the code throws the error?
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!