I'm trying to plot hurricane track data on a map, but I'm not super fluent in Matlab. I have a txt file that I'm loading into the system but the other resources I'm finding don't quite align with what I'm doing.
Edit: I've included the data. And below is a link to the method I tried using to plot.

6 个评论

Certainly without a sample of the data and what you've tried and where have specific problems, not much we can do.. plotm should do the trick presuming you have Mapping Toolbox...
Sorry about that, I have updated the question.
Well, that looks like pretty complete example...what happened when you tried to follow it?
  1. My data isn't in that exact format from the example.
  2. I'm not tracking 3 different hurricanes, just 1.
  3. I don't know what exactly to use from here and what I don't need.
dpb
dpb 2020-6-22
编辑:dpb 2020-6-22
Well, you don't get anywhere by not trying something! :)
  1. You have date, time, lat, lon...that's all that's needed to plot. Look at readtable as one likely candidate way to import the data file. You'll need to parse the lat, lon data to handle the appended direction, but that's handled easily enough by converting the cellstr() that will be returned by default with str2double() or similar.
  2. Well, it shouldn't take much imagination to stop in the example code after one data set nor to see with only one you don't have to select the data by ID/name.
  3. Try with the "Getting Started" documenation and the "On Ramp" training to get the barest of MATLAB syntax under belt...there's a whole section in the documentation on data import with examples for templates...
Thanks! That was helpful, but I'm still running into an issue. I can see the map, but my data isn't plotting. Here's what I've done so far and my output.
FloTrack = readtable('Florence_Track_edit.txt');
figure
FloTrack.Properties.VariableNames{1} = 'Date';
FloTrack.Properties.VariableNames{2} = 'Time';
FloTrack.Properties.VariableNames{3} = 'Latitude';
FloTrack.Properties.VariableNames{4} = 'Longitude';
FloTrack = removevars(FloTrack, 'Var5');
latFlorence = FloTrack.Latitude;
lonFlorence = FloTrack.Longitude;
geoplot(latFlorence, lonFlorence)
latFlorence = str2double(FloTrack.Latitude);
lonFlorence = str2double(FloTrack.Longitude);
geoplot(latFlorence, lonFlorence)
geolimits([0 50], [10 90])
geolimits([0 50], [-10 -90])
geoplot(latFlorence, lonFlorence, '.-')
geolimits([0 50], [0 90])
geolimits([0 50], [-90 0])

请先登录,再进行评论。

 采纳的回答

Tiana Johnson
Tiana Johnson 2020-6-23

0 个投票

convert data to excel file.
FloTrack = xlsread('FloTrack.xlsx', 1, 'C2:E80');
latFlorence = FloTrack(:, 1);
lonFlorence = FloTrack(:, 3);
geoplot(latFlorence, lonFlorence, '.-');
geolimits([10 50], [-90 0])

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by