The slowdown is due to the large number of graphics objects created by the script -- each call to "plotm" creates a separate graphics object which needs to be initialized and maintained in memory.
If you are plotting individual points with no connections between them, consider using the "scatterm" function instead.
If you are plotting groups of points (such as polygons) that should have connections between them, you can concatenate the data for each group into a single vector and separate the groups with NaN values:
lat1 = [0 10 10 0 0];
lon1 = [0 0 10 10 0];
lat2 = lat1 + 20;
lon2 = lon1;
combinedLat = [lat1, NaN, lat2];
combinedLon = [lon1, NaN, lon2];
plotm(combinedLat, combinedLon);
Best Answer