   warning('work in progress')

%% read bin file

   fid = fopen([fname(1:end-4),'bin']);
   
   D.n_channel               =      fread(fid, 1,'uint8');  % ok NB 1: number of sensor channels, standard is 8, optionally lower values, a.o. 5
   dummy                     =      fread(fid, 1,'char')';  % ok NB 1: 1 always 1
   D.version                 = char(fread(fid, 5,'char'))'; % ok NB 5: 1.0.8 software revision, e.g. "1.0.8"
   D.nrows                   =      fread(fid, 1,'uint32'); % ?? NB 4: data rows number of data rows; each row contains measured data of each of the channels. Each rows pertains to a single time step
                                                            %       4 bytes = uint32
   
   D.dt                      =      fread(fid, 1,'uint16'); % ?? NB 2: sample interval sample interval (time step) in milliseconds
                                                            %       2 bytes = uint16
     yymmddhhmnss            =      fread(fid, 6,'char');   % ok NB 6: date and time yy,mm,dd, hh,mn,ss
   D.datenum                 = datenum(2000 + yymmddhhmnss(1),...
                                              yymmddhhmnss(2),...
                                              yymmddhhmnss(3),...
                                              yymmddhhmnss(4),...
                                              yymmddhhmnss(5),...
                                              yymmddhhmnss(6));
   D.datestr = datestr(D.datenum,31);                                        
   
   % [ADC value]
   D.barometric_air_pressure =      fread(fid, 1,'uint16'); % ?? NB 2: barometric air pressure expressed in ADC value (16 bits)
                                                            %       2 bytes = uint16
   
   D.dummy                   = char(fread(fid,11,'char'))'; % NB 11: fill characters "###########";
   
   D
   
   %fread(fid, D.n_channel,'uint16')'
   
   fclose(fid);


% Format of SiltProfiler binary files
% Header data (32 characters)
% Below, in the header description, NB indicates number of bytes.
% The header data start at byte 1 and continue through byte 32.
% NB 1: number of sensor channels, standard is 8, optionally lower values, a.o. 5
% NB 1: 1 always 1
% NB 5: 1.0.8 software revision, e.g. "1.0.8"
% NB 4: data rows number of data rows; each row contains measured data of each of the channels. Each rows pertains to a single time step
% NB 2: sample interval sample interval (time step) in milliseconds
% NB 6: date and time yy,mm,dd, hh,mn,ss
% NB 2: barometric air pressure expressed in ADC value (16 bits)
% NB 11: fill characters "###########";
% Data
% The data rows start at byte 33 and continue till last sampled row.
% Each row contains measured data pertaining to 8 (or less, see above) channels
% Data are measured as 12 bit values (0 to 4095) but expressed as 16 bit values: before
% storage each measured value is multiplied by 16. Data values are recorded as integers.
% The channel sequence is listed in the .asc file (result of data conversion by SiltProfiler
% user interface); also the .ini file shows the sequence of the data channels/sensors,
% including the conversion constants.