Error using gcm?

10 Ansichten (letzte 30 Tage)
nuvolet
nuvolet am 15 Okt. 2018
Beantwortet: Chad Greene am 17 Okt. 2018
Hi all,
I am running a code which makes a global plot using plotm before I loaded coast.mat and defines the axesm as:
axesm('MapProjection','eqdcylin','Frame','on','Grid','on',...
'MapLatLimit',[-90 90],'MapLonLimit',lonlim, ...
'MeridianLabel','on','ParallelLabel','on','MLabelParallel','south')
The code worked perfectly but now is not getting this message:
Error using gcm (line 25)
Not a map axes.
Error in nextmap (line 24)
gcm; % Will error if gca is not a valid map axes
Error in nextmap (line 43)
nextmap
Error in plotm (line 59)
nextmap(varargin)
Error in plot_data_CLCS_5x5 (line 44)
plotm(coast.lat,coast.long);hold on; tightmap;
Anybody had the same problem and has been able to solve. Thanks in advance

Antworten (1)

Chad Greene
Chad Greene am 17 Okt. 2018
It looks like another plot was initialized or clicked on after calling axesm, because this should work just fine:
figure
lonlim = [-60 120];
axesm('MapProjection','eqdcylin','Frame','on','Grid','on',...
'MapLatLimit',[-90 90],'MapLonLimit',lonlim, ...
'MeridianLabel','on','ParallelLabel','on','MLabelParallel','south')
coast = load('coast');
plotm(coast.lat,coast.long)
whereas this will produce the error message you're getting:
figure
lonlim = [-60 120];
axesm('MapProjection','eqdcylin','Frame','on','Grid','on',...
'MapLatLimit',[-90 90],'MapLonLimit',lonlim, ...
'MeridianLabel','on','ParallelLabel','on','MLabelParallel','south')
coast = load('coast');
figure % <-THIS WILL SCREW THINGS UP
plotm(coast.lat,coast.long)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by