How to import axesm into app designer?
Afficher commentaires plus anciens
Hi,
I am developing a GUI using app designer. This contains multiple UIAxeses.
One of these UIAxeses is going to show site location in map using meshm and plotm functions. How can I convert an existing UIAxes to a map axes? or how can I import a map axes into the app designer?
unfortunately the axesm and worldmap functions open a new figure including a map axes which is not sutible for a standalone application. I have spent a large time for searching with no specific solution :(((
Réponse acceptée
Plus de réponses (1)
"...or how can I import a map axes into the app designer?"
You can copy the content of a map axis to a UI Axis. Here's a demo.
% Create map in external figure
korea = load('korea.mat');
Z = korea.map;
R = georasterref('RasterSize', size(Z), ...
'Latlim', [30 45], 'Lonlim', [115 135]);
worldmap(Z, R)
meshm(Z, R)
ax = gca();
% Create UIAxes and copy content
uif = uifigure();
uiax = uiaxes(uif);
copyobj(ax.Children, uiax)
uiax.Visible ='off';

4 commentaires
abblah abblah
le 5 Avr 2020
Adam Danz
le 5 Avr 2020
"This is not correct, ... you have not imported the map axes, you have only copied the map axes's children."
@abblah abblah, that's exactly what the description indicates at the top of my answer. In this answer, the app's axes are used to host the map content instead of replacing the axes.
Tamas
le 29 Sep 2023
Would you be able to copy also a colorbar and the colormap?
Adam Danz
le 2 Oct 2023
Copy the colormap using
uiax.Colormap = ax.Colormap;
You may also want to copy the CLim property if you made any changes to the color limits.
As for the colorbar, recreate it in the new figure. If there are any important colorbar properties you set in the figure containing the map axes, you can copy the property values between the two colorbars.
Catégories
En savoir plus sur Develop Apps Programmatically dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!