% 批量读取
clc
clear
path = 'c:\Users\15646\Downloads\IAP_CZ16_2019\';
dirOutput1=dir(fullfile(path,'*.nc'));
dirOutput2=dir(fullfile(path,'CZ*'));
fileNames1={
dirOutput1.name}; % 文件名
fileNames2={
dirOutput2.name}; % 文件名
filepath = {
dirOutput1.folder}; % 路径
start = [41 360]; % 确定多少个格点 打开一个文件确定
count = [41 180]; % 确定格点的起始位置 打开一个文件确定
for i = 1:12%nc文件的个数
pre=ncread(char(fileNames1(i)),'temp');
A=squeeze(pre(1,:,:));
%pre(pre < 0) = NaN;
% excel的名称
path1 = 'd:\trmm\'
name1=char(fileNames2(i));
name = strcat(name1(1:36),'.xls');
fil_path = strcat(path1,name);
xlswrite(fil_path,A);
end
nc文件转excel文件(matlab代码)
猜你喜欢
转载自blog.csdn.net/weixin_47696370/article/details/122626512
今日推荐
周排行