Hi!
I'm having a problem with geoscatter plotting.
I have an .xls file with lon and lat data in columns and I want to plot it as scatter points on a basemap. I'm using this code:
data = xlsread('test.xlsx');
lat=data(:,2);
lon=data(:,3);
figure(1)
geoscatter('lat','lon',);
geolimits([57.655 57.669],[11.84995 11.85])
title 'Hinsholmen Leisure Boat Harbour';
but I keep getting the same error message:
"Error using geoscatter (line 56)
Expected lat to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64"
My datapoints are numbers, they show as 'double' in the workspace. What am I doing wrong? I'm using MATLAB_R2019b

3 件のコメント

darova
darova 2019 年 11 月 26 日
Can't see any data
Agata Olejnik
Agata Olejnik 2019 年 11 月 26 日
I added an attachment now
darova
darova 2019 年 11 月 26 日
Try
data = xlsread('test.xlsx','B2:E37');
lat=data(:,2);
lon=data(:,3);

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

 採用された回答

Agata Olejnik
Agata Olejnik 2019 年 11 月 26 日

0 投票

I actually solved the problem by removing the citation marks in this line
geoscatter('lat','lon',);
so now the code looks like this
data = xlsread('test.xlsx');
lat=data(:,2);
lon=data(:,3);
figure(1)
geoscatter(lat,lon,);
geolimits([57.655 57.669],[11.84995 11.85])
title 'Hinsholmen Leisure Boat Harbour';
and works perfectly!

その他の回答 (0 件)

カテゴリ

質問済み:

2019 年 11 月 26 日

回答済み:

2019 年 11 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by