Modifying files and merge files
显示 更早的评论
Hi,
I have a file that has dates in the folowing format:
1011949 % This would be 01JAN1949
2011949 % This would be 02JAN1949
11031949 % This would be 11MAR1949 (and so on... up to 2010).
I need to modify this array in a way to have:
1011949 0
1011949 6
1011949 12
1011949 18
2011949 0
2011949 6
2011949 12
2011949 18
(and so on)
Thus I want to add hours (00,06,12,18) to each date. The resulting file would have two columns (data and time). Please can you help me with this?
Thanks, Djordje
采纳的回答
更多回答(2 个)
Sara
2014-8-1
fid1 = fopen('filewithdates','r');
fid2 = fopen('filewithhours','r');
fid3 = fopen('output.txt','w');
while 1
t1 = fget(fid1);t2 = fgetl(fid2);
if(~ischar(t1)),break,end
fprintf(fid3,'%s %s\n',t1,t2);
end
fclose all;
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!