feizhuzhu的个人博客分享 http://blog.sciencenet.cn/u/feizhuzhu

博文

批量读取nc文件并转为xlsx——matlab

已有 6148 次阅读 2019-11-12 13:44 |个人分类:matlab|系统分类:科研笔记| 批量nc, matlab

% 批量读取
clc
clear
path = 'd:\trmm_day_data'
dirOutput1=dir(fullfile(path,'*.nc4'));
fileNames1={dirOutput1.name}; % 文件名
filepath = {dirOutput1.folder}; % 路径
start = [289 1061]; % 确定多少个格点 打开一个文件确定
count = [64 100];   % 确定格点的起始位置  打开一个文件确定
for i = 1:7670 
    pre=ncread(char(fileNames1(i)),'precipitation',start ,count);
    %pre(pre < 0) = NaN; 
    % excel的名称
    path1 = 'd:\trmm\'
    name = strcat(char(fileNames1(i)),'.xls');
    fil_path = strcat(path1,name);
    xlswrite(fil_path,pre);
end

% lon1= 85.1250:0.25:109.875
% lat = 22.125:0.25:37.875




https://wap.sciencenet.cn/blog-3409733-1205849.html

上一篇:基于python2.7和arcpy重采样tif文件
下一篇:trmm按照年分类整理——R
收藏 IP: 124.16.174.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-19 14:53

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部