function readPS(shot)

% readPS(34187)
fname = ['s' num2str(shot) '_nc.ps'];
f = textread(fname,'%s','delimiter','\n','whitespace','');

L = length(f);

cc = 1;
while isempty(findstr(f{cc},'%%EndSetup')) && cc < L;
    cc = cc + 1;
end

f = f(cc+1:end);

L = length(f);

pos1 = zeros(L,1);

count = 0;
for i = 1 : L
    p = findstr(f{i},'!');
    if p  == 1
        count = count + 1;
        pos1(count) = i;
    end
end
pos1(pos1==0) = [];

num = zeros(length(pos1),4);
nc = cell(length(pos1));
count = 0;
count2 = 0;
for i = 1 : length(pos1)
    s =  strrep(f{pos1(i)},'!','');
    s =  strrep(s,') DP','');
    s = str2num(s);
    if length(s) == 4
        count = count + 1;
        num(count,:) = s;
    else
        count2 = count2 + 1;
        nc{count2} = s;
    end
end

nc(count2+1:end) = [];
num(count+1:end,:) = [];

whos
close(findobj(0,'Type','figure'))
figure
axes
hold on
plot1(num)
plot2(nc,'r')

function plot1(n,varargin)
for i = 1 : size(n,1)
    plot([n(i,1) n(i,1) + n(i,3)],[n(i,2) n(i,2) + n(i,4)],varargin{:})
end

function plot2(n,varargin)
for i = 1 : length(n)
    d = n{i};
    if mod(length(d),2) == 1
        disp(num2str(d));
        d = d(1:end-1);
        d = reshape(d,2,length(d)/2)';
        d = cumsum(d);
        plot(d(:,1),d(:,2),varargin{:});
    else
        d = reshape(d,2,length(d)/2)';
        d = cumsum(d);
        plot(d(:,1),d(:,2),varargin{:});
    end
end
