Routines for reading CDF files in IDL are present in the standard CDF distribution. There is no comparable facility for Matlab, however.
I have written several Matlab functions which provide a primitive facility to access data in CDF files. One, cdfinfo lists variables in a CDF file and their properties. Another, cdfread returns data from named variables in the file. Finally, cdf2date, cdf2ep and cdf2time convert CDF Epoch times to Matlab date format, 1950.0 Epoch and [YY DD HH MM SS] format respectively.
I have produced a distribution which contains SPARC Solaris executables of the programs, so if you use this platform you need not compile the programs. They are statically linked against the CDF library so you don't need to have this either. This distribution also contains source code.
If you do wish to compile the programs, you will need the Matlab v5.2 MEX compiler, which also needs a C compiler. Details vary from platform to platform: consult your Matlab documentation. You will also need the CDF library. There is a source-only distribution which is much smaller than the executable one. Compilation instructions are included in both distributions.
One advantage of compiling the programs yourself is that you can produce versions which are dynamically linked against the CDF library, making the executables much smaller (typically by a factor of about 10). Instructions on how to do this are also included in the distributions.
>> data=cdfread('test.cdf',{'Epoch','BGSE'});
>> BTime=cdf2date(data{1});
>> BGSE=data{2};
>> whos
Name Size Bytes Class
BGSE 1439x3 34536 double array
BTime 1439x1 11512 double array
data 2x1 46232 cell array
Grand total is 11514 elements using 92280 bytes
>> plot(BTime,BGSE(:,1))
| Program | Version | Date |
|---|---|---|
| cdfread | 0.42 | 03.11.99 |
| cdfinfo | 0.3 | 02.03.99 |
| cdf2date | 0.12 | 18.09.99 |
| cdf2ep | 0.2 | 29.04.99 |
| cdf2time | 0.2 | 29.04.99 |
| sizetest | 0.10 | 26.07.99 |
Two files are available for download: