我正在尝试使用以下格式重复读取文件(但由于它太长,我甚至已经删除了第一个重复的数据):
1.00 'day' 2011-01-02
'Total Velocity Magnitude RC - Matrix' 'm/day'
0.190189 0.279141 0.452853 0.61355 0.757833 0.884577
0.994502 1.08952 1.17203 1.24442 1.30872 1.36653
1.41897 1.46675 1.51035 1.55003 1.58595 1.61824这是原始的file
在我有一些数据文件有十进制数字的天。在这种情况下,我只是得到小数点前的数字,没有小数。我正在使用下面显示的代码来读取和存储。我如何在days中包含小数部分?例如,我希望days存储2.2而不是2。
fid = fopen(file_name); % open the file
dotTXT_fileContents = textscan(fid,'%s','Delimiter','\n'); % read it as string ('%s') into one big array, row by row
dotTXT_fileContents = dotTXT_fileContents{1};
fclose(fid); %# don't forget to close the file again
% str2match = '''Total Velocity Magnitude RC - Matrix'' ''m/day''';
%# f