0001 function Data = vb_read_stylus(fname)
0002
0003
0004
0005
0006
0007
0008
0009 key = '%';
0010
0011
0012 fid=fopen(fname);
0013
0014 if fid == -1, fprintf('[%s] can not be opened\n',fname);return; end;
0015
0016 Nline = 0;
0017
0018 while 1
0019 next_line = fgetl(fid);
0020 if ~ischar(next_line), break, end;
0021 if isempty( strfind(next_line,key)), break, end;
0022 Nline=Nline+1;
0023 end
0024
0025 fclose(fid);
0026
0027 fid=fopen(fname);
0028
0029 for n = 1:Nline
0030 next_line = fgetl(fid);
0031 end
0032
0033
0034
0035 Data = fscanf(fid,'%f',Inf);
0036
0037 fclose(fid);
0038
0039 [N M] = size(Data);
0040 Ndata = N*M/6;
0041
0042 Data = reshape(Data, [6 Ndata]);
0043 Data = Data';
0044 Data = Data(:,1:3);
0045