Unrecognized function or variable 'nc_varget'.
조회 수: 16 (최근 30일)
이전 댓글 표시
Hey Guys!
I am a begginer in MATLAB. I am currently working on a bulky netCDF file downloaded from ISIMIP3b. I wanted to divide my work into two parts: preprocessing and postprocessing. In preprocessing, I want to read a specific variable 'prcp' with the function nc_varget. However, I cannot solve the error "Unrecognized function or variable (nc)". You can help me if you've ever faced such an error and know how to fix it.
댓글 수: 2
Image Analyst
2022년 10월 17일
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Walter Roberson
2022년 10월 17일
편집: Walter Roberson
2022년 10월 19일
The source code for nc_varget does not use any variable named nc or otherwise have any nc that might lead to that message.
Is it possible that when you called the function you passed in the name of a file with nc extension but forgot to enclose the name in apostrophes?
채택된 답변
Cris LaPierre
2022년 10월 17일
편집: Cris LaPierre
2022년 10월 17일
How are you loading and reading in the netCDF file? Without seeing your code, it's hard to say what this error means. However, this is code I have used to load nc files in the past.
ncfile='bsbd-0.9.3.nc'; % filename is bsbd-0.9.3.nc
ncdisp(ncfile)
lon=ncread(ncfile,'lon'); % Load variable 'lon' from nc file
lat=ncread(ncfile,'lat'); % Load variable 'lat' from nc file
depth=ncread(ncfile,'depth'); % Load variable 'depth' from nc file
댓글 수: 0
추가 답변 (1개)
Habtamu
2022년 10월 19일
편집: Habtamu
2022년 10월 19일
댓글 수: 4
Walter Roberson
2022년 10월 20일
Notice the point there, that these days, the tools call the Mathworks functions underneath. If you just need equivalent functionality, then that should be fine, but if you need to "replicate" earlier experiments then it could potentially be important that you match the code as it was at the time.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!