matlab - 如何在Matlab中导入pts文件

标签 matlab pts

我有一个包含二维点 (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/

相关文章:

matlab - PCA降维分类

matlab - 在 MATLAB 中将一个矩阵与另一个矩阵相加

c++ - Windows 上的 GNU GSL 和 MATLAB

python - Matplotlib 保存文件稍后在 ipython 中重新编辑

video - 为什么容器和编解码器有不同的时基?

ffmpeg - 如何通过 ffmpeg (C++) 获取 rtsp-sesson 的开始时间? start_time_realtime 始终等于 -9223372036854775808

c - 从文件中读取数字(整数)并将其存储为二维数组

ffmpeg - 关于视频编码,PTS 是什么?

c - 在终端中读取 noon 命名管道

video - 为什么我无法将 4 秒 60 fps 的剪辑缩小到正好 1 秒?