How do I read a CDF file created with MATLAB 7.4 (R2007a) in MATLAB 7.1 (R14SP3)?

1 view (last 30 days)
I am trying to read a CDF file created with MATLAB 7.4 (R2007a) in MATLAB 7.1 (R14SP3) but I am unable to do so and receive the following error in MATLAB 7.1 (R14SP3).
ERROR: ??? NOT_A_CDF: Named CDF is corrupted or not actually a CDF.
Error in ==> cdfinfo at 156
tmp = cdfinfoc(filename);
Error in ==> cdfread at 130
info = cdfinfo(filename);

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 26 Mar 2023
Edited: MathWorks Support Team on 27 Mar 2023
This error is received due to the version mismatch of the libraries that are used to create the CDF file.
The library version used to create the CDF file is 3.1 in MATLAB 7.4 (R2007a) and 2.7 in MATLAB 7.1 (R14SP3).
CDF 3.0 or later will read a file that was created with any of the previous CDF versions, but a file created from scratch with CDF 3.0 or later cannot be read by versions 2.7, 2.6, 2.5, or 2.4.
For additional information, please refer to the link below.
As a possible workaround, you can use the CDFWRITE function and use the proper version string to specify the library version. Refer to the sample code below.
Execute this command in MATLAB 7.4 (R2007a) when writing data to the file example.cdf:
cdfwrite('example.cdf', {'Longitude', 0:360, 'Latitude', 10:20}, 'PadValues', {'Latitude', 10},'version', '2.7');
Execute the following command in MATLAB 7.1 (R14SP3) when reading in the file,
data = cdfread('example.cdf');

More Answers (0)


Find more on Startup and Shutdown in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by