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!