필터 지우기
필터 지우기

Nccreate and Ncwrite Questions

조회 수: 1 (최근 30일)
Al Onen
Al Onen 2012년 10월 9일
Hello, I have to convert some hourly data matrices from Excel to NetCDF, for this task I wrote the basic code below;
year='2009';
month='07';
day={'12'; '13'; '14'; '15'; '16'; '17'};
hour={'00'; '01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'; '11'; '12'; '13'; '14'; '15'; '16'; '17'; '18'; '19'; '20'; '21'; '22'; '23'};
for i = 1:6
for j = 1:24
Sheetname = strcat(year,month,day{i},hour{j},'00');
RAIN = xlsread('result2.xls',Sheetname);
NetCdfName=strcat(year,month,day{i},hour{j},'.LDASIN_DOMAIN2.nc');
nccreate(NetCdfName,'RAINC');
ncwrite(NetCDFName,'RAINC',RAIN);
end
end
My excel sheets have 63R x 132C all numerical data. When I try to run the code, I get the following error;
??? Undefined function or method 'nccreate' for input arguments of type 'char'.
Error in ==> ex2cdf at 16
nccreate(NetCdfName,'RAINC');
I also tried to run example codes on ncwrite and nccreate pages on function documentation, and got the same error for them. This is my first question and the second one is NetCDF files have some attribute tables before actual data stored within, so I was wondering whether ncwrite function creates this automatically. I only need the matrices imported from Excel file in NetCDF files.
Thanks in advance
  댓글 수: 3
Ashish Uthama
Ashish Uthama 2012년 10월 10일
Try typing 'which nccreate' if it says no file found, you are probably using an older version of MATLAB.
Al Onen
Al Onen 2012년 10월 10일
I'm using 2010b, and it said "no file found", thanks for feedback.

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

채택된 답변

John
John 2012년 10월 11일
NCREAD, NCWRITE, and NCCREATE were introduced in R2011a.
You can do one of two things. You could look at trying the low-level interface, but it really helps to have detailed knowledge about the netcdf library before trying that. Type "help netcdf" to get started.
You could also try snctools at http://mexcdf.sourceforge.net, which is a 3rd party tool that wraps MATLAB's low-level interface.

추가 답변 (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