function [x,y,ind] = read_xy(filename)
% Reads the SMS xys file 
% 
filename = 'C:\CMS\CMS_Polyhedral\Scalar1D\simulations\Flow_Scalar1D_sol.xy';

x = []; y =[]; ind = [];
fid = fopen(filename,'r');
for i=1:100
    tline = fgetl(fid);
    if ~ischar(tline), break, end
    if(strcmp(tline(1:3),'IXY'))
%         nlen = str2num(tline(5:end));
        nlen = sscanf(tline,'%*s %d');
        dat = fscanf(fid,'%f %f %f\n',[3,nlen])';
        ind = dat(:,1);
        x = dat(:,2);
        y = dat(:,3);
        break
    end
end
fclose(fid);
return