我有一个包含二维点 (x,y) 的 pts
文件,如下所示:
version: 1
n_points: 5
{
159.128 108.541
230.854 109.176
164.841 179.633
193.404 193.597
192.769 229.143
}
我如何读取这个文件并将这些数据导入到 Matlab 中的变量中?
谢谢。
最佳答案
我会那样做
FileId=fopen(Filename)
npoints=textscan(FileId,'%s %f',1,'HeaderLines',1)
points=textscan(FileId,'%f %f',npoints{2},'MultipleDelimsAsOne',1,'Headerlines',1)
% now you have the values you want you can put them in a matrix or any variable
Y=cell2mat(C);
关于matlab - 如何在Matlab中导入pts文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19841382/