Question

I have a pts file with 2d points (x,y) that looks like this:

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
}

How can I read this file and import this data into variables in Matlab?

Thanks.

Was it helpful?

Solution

i would do it like that

 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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top