function q = read_motionFile(fnamein)

%% read_motionFile.m
%% Ming Xiao 03/12/07


fin = fopen(fnamein, 'r');	
if fin == -1								
	error(['unable to open ', fnamein])		
end

nextline = fgetl(fin);

% second line is the numcolumns
nextline = fgetl(fin);
numcolumns = sscanf(nextline, 'datacolumns \t%d');

% third line is the numrows
nextline = fgetl(fin);

numrows = sscanf(nextline, 'datarows \t%d');

nextline = fgetl(fin);
nextline = fgetl(fin);

% sixth line is label
nextline = fgetl(fin);

q.labels = strread(nextline, '%s')';


% READ
q.data = fscanf(fin, '%f', [numcolumns, numrows])';