找回密码
 注册
Simdroid-非首页
查看: 41|回复: 1

map工具箱显示问题

[复制链接]
发表于 2014-2-27 19:25:52 | 显示全部楼层 |阅读模式 来自 山东青岛
本帖最后由 lhm901112 于 2014-2-27 19:28 编辑

在把计算数据贴到地图上时遇到的奇怪问题,循环显示多幅图像,但奇怪的是第一幅数据不能显示,后面的都可以正常显示,求大神指点迷津,程序附后(小菜鸟写的请多了解哈

  1. listing = dir('I:\new_data\Insar\Ascending\*.dat');
  2. path = cd;
  3. for p = 1:2
  4.    filename = listing(p).name;
  5.    U_x = dlmread(filename);
  6.    file = strcat(filename(1:end-3),'N1');
  7.    file = strcat(path,'\',file);
  8.    fid = fopen(file,'r','b');
  9.    
  10.    fseek(fid,5314,'bof');
  11.    a = fscanf(fid,'%c',10);
  12.    number = str2num(a);

  13.     %length
  14.    fseek(fid,5335,'bof');
  15.    a=fscanf(fid,'%c',10);
  16.    length=str2num(a);
  17.    length=(length-17)/4;

  18.    fseek(fid,4546+133,'bof');
  19.    a=fscanf(fid,'%c',21);
  20.    offset=str2num(a);
  21.    
  22.    sample_num=zeros(12,11);
  23.    lats=zeros(12,11);
  24.    lons=zeros(12,11);
  25.    line_num=zeros(12,1);
  26.    
  27.    for j=1:11
  28.        fseek(fid,offset+(j-1)*521+13,'bof');
  29.        line_num(j)=fread(fid,1,'uint32');
  30.        fseek(fid,8,'cof');
  31.        sample_num(j,:)=fread(fid,11,'uint32');
  32.        fseek(fid,88,'cof');
  33.        lats(j,:)=fread(fid,11,'int32')/1e6;
  34.        lons(j,:)=fread(fid,11,'int32')/1e6;
  35.    end
  36.    
  37.    fseek(fid,521+34,'cof');
  38.    line_num(12)=number;
  39.    sample_num(12,:)=fread(fid,11,'uint32');
  40.    fseek(fid,88,'cof');
  41.    lats(12,:)=fread(fid,11,'int32')/1e6;
  42.    lons(12,:)=fread(fid,11,'int32')/1e6;
  43.    
  44.    x=sample_num;y=repmat(line_num,1,11);
  45.    xi=repmat(1:length,number,1);
  46.    yi=repmat((1:number)',1,length);
  47.    lat=interp2(x,y,lats,xi,yi);
  48.    lon=interp2(x,y,lons,xi,yi);
  49.    clear xi & yi;
  50.    
  51.    lat=downsample(lat,floor(number/length)^2);lat=downsample(lat',floor(number/length));lat=lat';
  52.    lon=downsample(lon,floor(number/length)^2);lon=downsample(lon',floor(number/length));lon=lon';
  53.   
  54.    
  55.    % pass title
  56.    fseek(fid,1946,'bof');
  57.    a=fscanf(fid,'%c',10);
  58.    ind=strcmp(a,'DESCENDING');
  59.    if ind
  60.        lat=fliplr(lat);
  61.        lon=fliplr(lon);
  62.        %U_x=fliplr(U_x);
  63.    else
  64.        lat=flipud(lat);
  65.        lon=flipud(lon);
  66.        %U_x=flipud(U_x);
  67.    end
  68.    
  69.    figure;
  70.    clf;
  71.    hold on
  72.    m_proj('UTM','lon',[min(min(lon))-0.2 max(max(lon))+0.2],'lat',[min(min(lat))-0.2 max(max(lat))+0.2]);         
  73.    m_grid('xlabeldir','middle','fontsize',10,'tickdir','in','box','fancy','ylabeldir','middle');   
  74.    h=m_pcolor(lon,lat,U_x);
  75.    m_gshhs_f('patch',[.7 .7 .7]);
  76.    set(h,'edgecolor','none')
  77.    caxis([-1.0 1.0])
  78.    
  79.    h=colorbar('v');
  80.    set(get(h,'title'),'string','m/s','fontsize',10);
  81.    set(h,'pos',[0.8570 0.1560 0.02 0.7440])

  82.    
  83. %    clearvars -except p listing
  84.    
  85. end
复制代码
 楼主| 发表于 2014-2-27 19:26:58 | 显示全部楼层 来自 山东青岛
Simdroid开发平台
本帖最后由 lhm901112 于 2014-2-27 19:28 编辑

C:\Users\lihuimin\Desktop\QQ截图20140227193531.jpg
图没上去

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-10-3 01:33 , Processed in 0.036266 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表