Read "binary" variable from HDF-EOS file

4 次查看(过去 30 天)
NASA makes gridded data available from the CALIPSO satellite in the form of HDF-EOS files. The data can be read into Matlab using hdfread. Most variables are single type and work just fine. But one variable, 'Days_Of_Month_Observed', is supposed to be a kind of binary representation of the days of the months where observations were taken. e.g. 1001001 would indicate obs taken on the 1st, 4th, and 6th days of the month. More detail is provided here:
Matlab will read the data, but the result is junk: data = hdfread(filename,'Days_Of_Month_Observed'); reads the variable as type uint32 with values like: 1089536 67764224 1411923968 etc.
I have no idea how to get Matlab to read a binary variable from an HDF-EOS file. Ultimately I'd like to be able to count the number of days with samples taken. Any ideas?
edit: There's a function called de2bi that ought to help convert the decimal (which is what I think is being read as uint32) to the binary. Still working on getting it right. Help would be appreciated.

采纳的回答

Walter Roberson
Walter Roberson 2013-3-18
dobs = dec2bin(data, 32) - '0';
would work for arrays of data. Row J for data(J), column K for bit #K (from the beginning).

更多回答(0 个)

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by