Can not read in a cdf

I am rather new to MATLAB and I am trying to read in a cdf file. After downloading a patch, i entered "addpath 'C:\matlab-cdf_patch'" then tried to read in the cdf file with "data=cdfread('test.cdf')"... from there I get the errors:
Undefined function 'cdfinfoc' for input arguments of type 'char'.
Error in cdfinfo (line 165) tmp = cdfinfoc(filename);
Error in cdfread (line 216) info = cdfinfo(filename);
and do not know what they mean. Please help, thank you

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 11 Oct 2011

0 votes

Where did you download the patch? What version of MATLAB are you using? Can you try to run the following command to see if there is any error?
which example.cdf -all;
cdfinfo('example.cdf');
data=cdfread('example.cdf')

2 commentaires

Anthony
Anthony le 12 Oct 2011
I downloaded the patch from:
http://cdf.gsfc.nasa.gov/html/matlab_cdf_patch.html
I am using the MATLAB trial because I want to make sure it can perform my necessary operations before purchase. After typing in the following commands, these are the errors I received:
Trial>> which test.cdf -all
C:...\...\...(file path)\test.cdf
Trial>> cdfinfo('test.cdf')
Undefined function 'cdfinfoc' for input arguments of type 'char'.
Error in cdfinfo (line 165)
tmp = cdfinfoc(filename);
Thank you for your help
Fangjun Jiang
Fangjun Jiang le 12 Oct 2011
MATLAB provides a cdfread() function. I don't know why do you need to download a patch from NASA website. Remove your 'C:\matlab-cdf_patch' folder from your MATLAB path to see if you already have the cdfread() function by typing
which cdfread -all
The 'example.cdf' file is provided by MATLAB too. I was trying to tell you to go through that example to see if cdfread() can read it correctly. Here is a link to the document of cdfread(). http://www.mathworks.com/help/techdoc/ref/cdfread.html. It was available at least in R2007b. You can get that help by typing help cdfread.

Connectez-vous pour commenter.

Tags

Question posée :

le 11 Oct 2011

Community Treasure Hunt

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

Start Hunting!

Translated by