poster
2019-12-10, 20:48
我有一个文本文件,其中包含如下格式的数据:
000000:11.315 2049.000000 000000:11.320 2050.000000 000000:11.327 2048.000000 000000:11.333 2050.000000 000000:11.338 2049.000000 000000:11.348 2048.000000 如何将数据提取到三个数组中?我玩过textscan ,但是我无法找出合适的格式字符串。 (行数当然不是6,而是任意的。)
回答:
fid = fopen('dat.txt'); scannedData = textscan(fid, '%f:%f %f', 'CollectOutput', true) fclose(fid);
更多&回答... (https://stackoverflow.com/questions/4364826)
000000:11.315 2049.000000 000000:11.320 2050.000000 000000:11.327 2048.000000 000000:11.333 2050.000000 000000:11.338 2049.000000 000000:11.348 2048.000000 如何将数据提取到三个数组中?我玩过textscan ,但是我无法找出合适的格式字符串。 (行数当然不是6,而是任意的。)
回答:
fid = fopen('dat.txt'); scannedData = textscan(fid, '%f:%f %f', 'CollectOutput', true) fclose(fid);
更多&回答... (https://stackoverflow.com/questions/4364826)