Make a tensor with nc images?

3 views (last 30 days)
Lilia A.L.
Lilia A.L. on 29 Sep 2015
Commented: Lilia A.L. on 1 Oct 2015
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!

Accepted Answer

Chad Greene
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.
  1 Comment
Lilia A.L.
Lilia A.L. on 30 Sep 2015
Thanks for your help! Actually my files are .mat, we made an orthorectification because are from level 1. Should I change the files to NetCDF? I´m new with MatLab!!!

Sign in to comment.

More Answers (2)

Chad Greene
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.

Kelly Kearney
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.
  1 Comment
Lilia A.L.
Lilia A.L. on 1 Oct 2015
All the files were generated with the -v7.3 argument with save.
I think I got It! Thanks!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!