How to covert a geoplot into an mage file in app designer.

6 ビュー (過去 30 日間)
Vishal Tripathi
Vishal Tripathi 2021 年 3 月 7 日
コメント済み: Vishal Tripathi 2021 年 3 月 10 日
I'm designing a application for my project. I have used following code to geoplot a datafile given below. I just want to take screenshot or export the geoplot into an image file.
latitude = data.Var9;
longitude = data.Var10;
gx = geoaxes(app.GEOGRAPHICALMAPTab); %GEOGRAPHICALMAPTab is a tab used as a geoplot container(where Geoplot is shown)
geoplot(gx,latitude,longitude,'LineWidth',2,'Color','green');
text(gx,latitude(1,1),longitude(1,1),'START',"FontName",'Palatino','FontSize',18)
text(gx,latitude(end,1),longitude(end,1),'END','FontName','Palatino','FontSize',18)
geobasemap streets
I have already used functions like getframe,copyUIAxes etc but none is working. Can anyone please help me ??
  6 件のコメント
Vishal Tripathi
Vishal Tripathi 2021 年 3 月 10 日
gx and mentioned before is a handle.
gx = geoaxes(app.GEOGRAPHICALMAPTab);
I looked into the documents of the copyobj and once i used the previous code, i was getting not enough input error but I figured aout the correct code later
copyobj(gx,app.GEOGRAPHICALMAPTab) \\ by adding the parent name.
Adam Danz
Adam Danz 2021 年 3 月 10 日
Ah, ok, gx is a GeographicAxes handle, I see that now.
Looks like you hit the target! You were missing the parent input. However, this doesn't address your original question on how to save an image of the figure. Are you still stuck on that? Matlab recently released a few functions that do just that but other methods are needed in older releases.

サインインしてコメントする。

採用された回答

Monisha Nalluru
Monisha Nalluru 2021 年 3 月 10 日
Hi Vishal,
From my understanding you want to take the existng plot and save it as an image
This can be done by using print method of matlab which allows you to save the image in required format,
Here is an example
latSeattle = 47.62;
lonSeattle = -122.33;
latAnchorage = 61.20;
lonAnchorage = -149.9;
geoplot([latSeattle latAnchorage],[lonSeattle lonAnchorage],'g-*')
geolimits([45 62],[-149 -123])
print('geoimg','-dpng'); % save a file geoimg.png
imshow(imread("geoimg.png")) % display geoimg.png
Hope this helps!
  2 件のコメント
Vishal Tripathi
Vishal Tripathi 2021 年 3 月 10 日
I'm getting errors like print doesn't work in Appdesigner but i solved my problem using exportgraphics function
for more info visit:
https://in.mathworks.com/help/matlab/ref/exportgraphics.html
Vishal Tripathi
Vishal Tripathi 2021 年 3 月 10 日
Thank you for your support @Adam Danz and @Monisha Nalluru

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by