0001 function X = vb_read_vrml_coordinate(fname, Nskip, Nline, Mmax, key)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 fid=fopen(fname);
0020
0021
0022 for n=1:Nskip
0023 next_line = fgetl(fid);
0024 end
0025
0026
0027 X = zeros(Nline,Mmax);
0028 nn = 0;
0029
0030
0031 ix = strfind(next_line,key);
0032
0033 if ~isempty(ix)
0034 next_line = next_line(ix+1:end);
0035
0036 if ~isempty(next_line)
0037 x = sscanf(next_line,'%f');
0038 Nx = length(x);
0039 if Nx > 0,
0040 nn = nn + 1;
0041 X(nn, 1:Nx) = x';
0042 end
0043 end
0044 end
0045
0046 for n=1:Nline
0047 next_line = fgetl(fid);
0048
0049 x = sscanf(next_line,'%f');
0050 Nx = length(x);
0051 if Nx > 0,
0052 nn = nn + 1;
0053 X(nn, 1:Nx) = x';
0054 end
0055 end
0056
0057 fclose(fid);
0058
0059 X = X(1:nn,:);