function S = loadStrokes(filename)

% function S = LOADSTROKES( FILENAME )
%
% Loads stroke-based data in MIT DRS (Design Rational Stroke) file 
% format. Loads strokes into a cell array, S, with one entry for each 
% stroke.
% Each entry is an Nx3 array, where N is the number of points in the
% stroke and there is one column for X-coordinate, 
% one for Y-coordinate and one for timestamp.
%
% Author: Christine Alvarado
% Date: October 28, 2005

fid = fopen(filename,'r');
% skip the header lines
fgetl(fid);
fgetl(fid);
fgetl(fid);

% now get and parse each stroke into the necessary format
stroke = fgetl(fid);
num = 1;
while stroke ~= -1
    clear ptsa;
    stroke
    pts = regexp( stroke, '\(([^\)]*)\)', 'tokens' );
    pts
    for k = 1:size(pts, 2)
        a = pts{1, k};
        a = char(a);
        [x y t] = strread(a);
        ptsa(k, :) = [x y t];
    end
    S{num} = ptsa;
    num = num+1;
    stroke = fgetl(fid);
end
fclose(fid);
   