tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function str=getargument(source,search) tomwalters@0: % usage: str=getargument(source,search) tomwalters@0: % searchs in the pairs of parameters 'param','value' for the argument and returns the value as string tomwalters@0: % source must be a even number of input parameters tomwalters@0: tomwalters@0: % for compatibility with old version tomwalters@0: if ~isfield(source,'name') tomwalters@0: nr=size(source,2); % so many pairs tomwalters@0: for i=1:nr tomwalters@0: param=source(i); tomwalters@0: if strcmp(param,search) tomwalters@0: str= source(i+1); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: str{1}=''; tomwalters@0: return tomwalters@0: tomwalters@0: else tomwalters@0: tomwalters@0: % new version is much more elegant tomwalters@0: nr=size(source.name,2); % so many pairs tomwalters@0: for i=1:nr tomwalters@0: param=source.name{i}; tomwalters@0: if strcmp(param,search) tomwalters@0: str=source.argument{i}; tomwalters@0: tomwalters@0: % if the argument is put into "[]" then remove them tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: str=''; tomwalters@0: return tomwalters@0: tomwalters@0: