在MatLab中解析文件 [英] Parse file in MatLab
本文介绍了在MatLab中解析文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在MatLab中解析文件,使用这种格式的文本中的数据.
I want to parse file in MatLab, the data in the text with this format.
15.01245 20.478
12.589 58.256
我使用了此功能:
fid = fopen('file.txt');
tline = fgets(fid);
while ischar(tline)
disp(tline)
tline = fgets(fid);
end
fclose(fid);
它给了我线条,但是我想提取它并将其存储为数组 像:
It gave me the lines, but i want to extract it and store it as array like:
data(1,1)= 15.01245,data(1,2)= 20.478
我该怎么做?
谢谢
推荐答案
只需调用
data = load('file.txt')
这篇关于在MatLab中解析文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文