Error reading .nc file

16 views (last 30 days)
Phoebe Armitage
Phoebe Armitage on 4 May 2021
Hi, how do I solve this error?
Error using (line 1272)
Could not open for reading.
Error in (line 121)
Error in ncread (line 61)
ncObj =;

Answers (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni on 7 May 2021
The issue could be due to a corrupt MATLAB installation.
In order to ensure that other MEX files can be loaded properly in MATLAB, you can try executing the following commands in MATLAB Command Window:
>> imread('example.tif');
>> h5read('example.h5', '/g1/g1.1/dset1.1.1');
The above commands use MEX files and if they work it means that Visual C++ 2015 Redistributable has been installed properly.
This error can be caused when the Visual C++ Redistributable is missing and hence there is dependency issue.
To identify the missing library dependencies, please download "dependency walker" from the link below:
Install one of the supported version of the compiler (Microsoft Visual C++ only) on the machine which will install the redistributable automatically. Please find the list of supported compilers below:
If you have access to another machine, you could also check if the same NetCDF file can be read on MATLAB on that machine.
If you cannot use dependency walker on your system, we are unable to identify which DLLs are missing. So, we suggest to do a fresh installation of MATLAB and try reading the file again.
Hope it helps.

Community Treasure Hunt

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

Start Hunting!

Translated by