matlab新技能
直接读取mat文件内结构体中的变量
value = cell2mat(struct2cell(load(filelist(1).name)));
三维数组转置一维二维
permute(value2,[2 1 3]);
二维经纬度加变量绘制地图
geoshow( lat, lon, value, ,'DisplayType','texturemap' );
colormap ( flipud(gray) );
caxis ( [250 320] );
xlim ([80 130]);
ylim ([10 60]);
xlabel('Longitude','FontSize',16);
ylabel('Latitude','FontSize',16);
set (gca,'XColor','k','YColor','k','LineWidth',1.5);
txt_file = file(1:25);
title (num2str(txt_file),'FontSize',16);
上下翻转
flipud
左右翻转
fliplr
重新排列
reshape(A,8,1)
A转为8行1列
站点分布图
clear;
clc;
for i = 1:size (anhui_sites,1)-1
scatter (anhui_sites(i,3),anhui_sites(i,2),70,'k','filled');
hold on;
scatter (anhui_sites(i+1,3),anhui_sites(i+1,2),70,'k','filled');
end
clear i;
hold on;
linetower = xlsread('latlon.xlsx');
for i = 1:size (linetower,1)-1
plot ( [ linetower(i,1) linetower(i,3)], [ linetower(i,2) linetower(i,4)],'r','LineWidth',3 );
hold on;
plot ( [ linetower(i+1,1) linetower(i+1,3)], [ linetower(i+1,2) linetower(i+1,4)],'r','LineWidth',3 );
end
hold on;
for i = 1:size (linetower,1)
% scatter (linetower(i,1),linetower(i,2),70,'r^','filled');
% hold on;
% scatter (linetower(i+1,3),linetower(i+1,4),70,'r^','filled');
scatter (linetower(i,1),linetower(i,2),70,'r^','filled');
hold on;
scatter (linetower(i,3),linetower(i,4),70,'r^','filled');
end
clear i;
hold on;
map = 'D:\satellite\chinamap\diquJie_polyline.shp';
geoshow(map,'linewidth',1, 'Color', [0 0 0]);
hold on;
map_all = 'D:\satellite\chinamap\bou2_4l.shp';
geoshow(map_all,'linewidth',1, 'Color', [0 0 0]);
xlabel('Longitude','FontSize',16);
ylabel('Latitude','FontSize',16);
set (gca,'XColor','k','YColor','k','LineWidth',1.5);
xlim ([115 120]);
ylim ([29 32]);
set (gca, 'box','on');