How do I correct meridian labels exceeding 180 degrees with the Mapping Toolbox?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 20 de Mayo de 2021
Respondida: MathWorks Support Team
el 23 de Jun. de 2021
When labeling meridians in the mapping toolbox, my axis reads [200W 180W 160W] instead of [160E 180W 160W]. How do I correct this?
Respuesta aceptada
MathWorks Support Team
el 20 de Mayo de 2021
Use the "wrapTo360" function to change the angle corresponding to each label between 0 to 360 degrees. Additionally, check if the angle turns out to be greater than 180 degrees. If so, do a string replacement to change the label from 'W' to 'E'.
This code will simply need to be pasted at the end of your current code:
h = mlabel('on');
for i=1:length(h)
labelStrings(i)=string(h(i).String{2});
value = str2double(extractBetween(labelStrings(i),2,"^"));
value = wrapTo360(value);
if value > 180
value = 360 - value;
labelStrings(i) = strcat(" ",num2str(value),"^{\circ} E");
h(i).String{2} = labelStrings(i);
end
end
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!