% tool
% 
%   INPUT VALUES:
%  
%   RETURN VALUE:
%
% 
% (c) 2003-2008, University of Cambridge, Medical Research Council 
% Maintained by Tom Walters (tcw24@cam.ac.uk), written by Stefan Bleeck (stefan@bleeck.de)
% http://www.pdn.cam.ac.uk/cnbh/aim2006
% $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
% $Revision: 585 $

function str=readparameterfile(filename)

lines=loadtextfile(filename);
nr_lines=size(lines,2);

varcounter=1;
for i=1:nr_lines  % tranlsate each line in a parameter and a value
    line=lines{i};
    count=1;tab=sprintf('\t');ret=sprintf('\n');
    maxline=size(line,2);
    while ~strcmp(line(count),' ')  & ~strcmp(line(count),tab) & count < maxline  & count <1000 % run till the first space
        count=count+1;
    end
    str1=line(1:count-1);
    str2=line(count+1:end);
    if strcmp(str2,'')        str2=' ';    end
    
    str.name{varcounter}=str1;
    str.argument{varcounter}=str2;
    varcounter=varcounter+1;
end



