# How to read a NetCDF4 file in Matlab?

I have downloaded the sea surface temperature data from the Ocean Color website, the file is in NetCDF format and contains no of geophysical_data variables like sst, qual_sst, flag_sst, bias_sst, etc. I used the following MATLAB code for file read and it is giving me an error:

temp=ncread('A2014213085500.L2_LAC_SST.x.nc','sst')


Error:

Error using internal.matlab.imagesci.nc/getGroupAndVarid (line 2075)
Could not find variable or group 'sst' in file.

[gid, varid] = getGroupAndVarid(this, location);



Can someone tell me what is the cause of the error?

• There is NetCDF-3 and NetCDF-4. What format is your data in and what format is your reading routine for? – gerrit Jul 27 '15 at 10:54
• What is the main difference b/w these two ? because i don't know in which format my file is, how can i find that ? i checked the file property and its just show me .NC file type. – Ahsan Jul 27 '15 at 17:04
• Several questions: Why that website for sea surface temperature? (Why not hycom.org?) What website? (It's always good to say exactly where.) What file did you download? Did you use ncdump to examine the contents of that file? Why did you use FTP when you could be using openDAP? – David Hammen Jul 28 '15 at 13:55