annotate aim-mat/tools/readparameterfile.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % tool
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
bleeck@3 7 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 8 % (c) 2011, University of Southampton
bleeck@3 9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 10 % download of current version is on the soundsoftware site:
bleeck@3 11 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 12 % documentation and everything is on http://www.acousticscale.org
bleeck@3 13
tomwalters@0 14
tomwalters@0 15 function str=readparameterfile(filename)
tomwalters@0 16
tomwalters@0 17 lines=loadtextfile(filename);
tomwalters@0 18 nr_lines=size(lines,2);
tomwalters@0 19
tomwalters@0 20 varcounter=1;
tomwalters@0 21 for i=1:nr_lines % tranlsate each line in a parameter and a value
tomwalters@0 22 line=lines{i};
tomwalters@0 23 count=1;tab=sprintf('\t');ret=sprintf('\n');
tomwalters@0 24 maxline=size(line,2);
tomwalters@0 25 while ~strcmp(line(count),' ') & ~strcmp(line(count),tab) & count < maxline & count <1000 % run till the first space
tomwalters@0 26 count=count+1;
tomwalters@0 27 end
tomwalters@0 28 str1=line(1:count-1);
tomwalters@0 29 str2=line(count+1:end);
tomwalters@0 30 if strcmp(str2,'') str2=' '; end
tomwalters@0 31
tomwalters@0 32 str.name{varcounter}=str1;
tomwalters@0 33 str.argument{varcounter}=str2;
tomwalters@0 34 varcounter=varcounter+1;
tomwalters@0 35 end
tomwalters@0 36
tomwalters@0 37
tomwalters@0 38