How to import mixed date format into matlab
2 次查看(过去 30 天)
显示 更早的评论
I have the following date columns parts of them: (yyyy mm dd) parts of them: (yyyy mmdd) parts them: (yyyymmdd)
I just want to import into matlab with separate columns of year, month, and days.
please have a look the textfile attached
采纳的回答
Walter Roberson
2018-4-14
fid = fopen('01643000.txt');
datacell = textscan(fid,'%8c%f%f%f%f%f', 'CollectOutput',true);
fclose(fid);
years = str2double(cellstr(datacell{1}(:,1:4)));
months = str2double(cellstr(datacell{1}(:,5:6)));
days = str2double(cellstr(datacell{1}(:,7:8)));
other_data = datacell{2};
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!