Make a tensor with nc images?
3 views (last 30 days)
Show older comments
Hello, I´m trying to make a Tensor with satellite images of Chloroplyll. I have a script to make a tensor but It´s for hdf images and since juanury the NOAA changed the format, now are nc. I have this errors: Error using hdfquickinfo (line 15) HDF file 'C:\Maestria\Imagenes\Clo\clo200801.mat' may be invalid or corrupt.
Error in hdfread>dataSetInfo (line 356) hinfo = hdfquickinfo(filename,dataname,params);
Error in hdfread (line 209) [hinfo,params] = dataSetInfo(varargin{:});
Error in oceancolor (line 53) nl = double(cell2mat(hdfread(hdffile,'Number of Lines'))); %No de lineas de lat
Error in Tensor (line 16) [data,lon,lat,dndate, units, parameter]=oceancolor(archi,lonlims,latlims);
I think I need a different function, but I have no idea what It could be. Thanks so much for your help!
0 Comments
Accepted Answer
Chad Greene
on 29 Sep 2015
I think you need ncread rather than hdfread. NetCDF and HDF formats are quite similar, but there are some minor differences between the two. The transition from HDF to NetCDF should be relatively painless.
More Answers (2)
Chad Greene
on 1 Oct 2015
Ah, .mat files are Matlab's own file format. The nice thing about .mat files is that they're super easy to work with when you use Matlab. The bad thing about .mat files is they're very frustrating for people who do not use Matlab because .mat files are not human readable. Luckily you're using Matlab so you should be able to just say
load clo200801.mat
And then the variables will be in your workspace.
0 Comments
Kelly Kearney
on 1 Oct 2015
How were the .mat files generated? Version 7.3 .mat files (created using the -v7.3 argument with save) are technically hdf5 files, so they could be read via the hdf-related functions ( load is probably easier, but hdfread may make sense for your application). However, the default Version 7 .mat files are a different binary format, so those can only be read via load.
My guess is your old .mat files were saved with the -v7.3 flag, and your new ones weren't.
See Also
Categories
Find more on NetCDF 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!