how to read date and time in a binary header file
1 view (last 30 days)
Show older comments
i want to read the header info of a binary file which contains the time and date.i used the following code. but i'm not getting.Kindly help....
close all; clear all; close all; clc fi=fopen ('C:\mar6\file\a.txt','r'); n=1;l2=60; % R = nan ([2000 l2]); % CN=nan ([2000 l2]); for j=1:60 g=fscanf(fi,'%s',1) l1=fopen(g,'r') % headerread=struct('Mustbe',fread(l1,1,'int16'),'trigger',fread(l1,1,'int8'),'Dwell', fread(l1,1,'int8'),... 'Dwellunits',fread(l1,1,'int8'),'Acqmode',fread(l1,1,'int8'),'Dwell913',fread(l1,1,'int64'),.... 'Passlen',fread(l1,1,'int16'),'passcount',fread(l1,1,'int16'),'passcountpreset',fread(l1,1,'int16'),.... 'acq_time1',fread(l1,8,'*char'),'acq_date1',fread(l1,8,'*char'),'Markcha',fread(l1,1,'int16'),'MCSno',fread(l1,1,'int8'),.... 'Caltype',fread(l1,1,'int8'),'CalUnits',fread(l1,4,'*char'),'CalCoef0',fread(l1,1,'float'),'CalCoel1',fread(l1,1,'float'),.... 'Extdwell',fread(l1,1,'int16'),'Res',fread(l1,1,'int32'),'Res1',fread(l1,1,'int8'),'Summode',fread(l1,1,'int8'),.... 'Idebyte',fread(l1,1,'int8'),'Prodwell',fread(l1,1,'int8'),'Deslength',fread(l1,1,'int8'),'Detdis',fread(l1,68,'*char'),.... 'SamDeslen',fread(l1,1,'int8'),'SamDes',fread(l1,68,'*char'),'Lineardisplayflag',fread(l1,1,'int8'),... 'Linearscale',fread(l1,1,'int8'),'Dispstart',fread(l1,1,'int16'),'Dispnoofchannels',fread(l1,1,'int16'),... 'Res2',fread(l1,1,'*char'),'Discsel',fread(l1,1,'int8'),'Discedge',fread(l1,1,'int8'),'Discvol',fread(l1,1,'float'),... 'SCAulv',fread(l1,1,'float'),'SCAllv',fread(l1,1,'float'),'Dwelltime',fread(l1,1,'float'),'Conflag',fread(l1,1,'int8'),... 'Res3',fread(l1,13,'*char'),'Calcoef2',fread(l1,1,'float'),'Calcoef3',fread(l1,1,'float'),'MCSIDstring',fread(l1,8,'*char')); t1(1,j)=str2num('l1(1:2)') t2(i,j)=str2double('g.acq_time1(4:5'); t3(i,j)=str2double('g.acq_time1(7:8)'); t4(i,j)=t1(i,j)+(t2(i,j))./60+(t3(i,j))./3600; if t4(i,j)<17 t4(i,j)=t4(i,j)+24
end
4 Comments
Jan
on 18 Jul 2013
@dpb: We both really tried to encourage the OP to improve the question. Unfortunately he hesitates to do so.
dpb
on 19 Jul 2013
Indeed... :(
Seems like a lot recently that have either never returned or at least left no trail if they did after providing either answers or requesting further clarifications or simply making (hopefully improving) comments.
It's quite discouraging given the amount of effort it takes to respond in the forum format anyway that it's more impetus to just stick to cs-sm--at least there one has the benefit of a newsreader to only get the active stuff w/o having to go find it.
Answers (1)
REJI
on 18 Jul 2013
1 Comment
Jan
on 18 Jul 2013
Please remove this. It is much better to add all important details to the original question instead of using the answers or comment sections.
Please follow the "? Help" link to learn, how to format code in the forum. It is not really intuitive, but very easy. And omitting the formatting hurts the eyes of the reader.
See Also
Categories
Find more on Startup and Shutdown 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!