Export array as excel format

조회 수: 7 (최근 30일)
Majid Mohamod
Majid Mohamod 2017년 6월 6일
댓글: Majid Mohamod 2017년 6월 6일
Hi all,
The following code is work perfectly to read the netcdf files. It has written by KSSV.
files = dir('*.nc4') ;
nfiles = length(files) ;
P = cell(nfiles,1) ; % precipitation of all files
date = cell(nfiles,2) ;
time = cell(nfiles,2) ;
for i = 1:nfiles
%%Read dat
date{i,1} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.BeginDate') ;
date{i,2} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.EndDate') ;
%%Read time
time{i,1} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.BeginTime') ;
time{i,2} = ncreadatt(files(i).name,'/','HDF5_GLOBAL.EndTime') ;
%%REad precipitation
P{i} = ncread(files(i).name,'precipitation') ;
end
I added the following part, in order to export the array "P" as excel format. Please, I have basic knowledge to solve this problem. I appreciate your help and time!
Majid
i=1:nfiles
X=[{'P'};P]
xlswrite('f',X)
end

채택된 답변

KSSV
KSSV 2017년 6월 6일
편집: KSSV 2017년 6월 6일
myfile = 'myfile.xlsx' ;
for i = 1:nfiles
xlswrite(myfile,P{i},i)
end
Each nc-file's precipitation data written into one sheet of excel file.
  댓글 수: 1
Majid Mohamod
Majid Mohamod 2017년 6월 6일
it works perfectly :)
Thank you man

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by