tomwalters@0: % procedure for 'aim-mat' tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % tomwalters@0: % (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: tomwalters@0: function handles=createparameterfile(handles,paramname) tomwalters@0: % create parameters from that file tomwalters@0: % when no second parameter is given, then load it using the standart way: tomwalters@0: % go through all directories and call the single module-parameterfiles tomwalters@0: tomwalters@0: tomwalters@0: if nargin==1 % if no parameter file is given, then take the standart one tomwalters@0: % first load the default values from the default parameter file: tomwalters@0: handles=loadallparameterfiles(handles); tomwalters@0: if handles.error==1 tomwalters@0: return tomwalters@0: end tomwalters@0: tomwalters@0: if isfield(handles,'initial_options') % aim was called with initial parameters tomwalters@0: % overwrite the parameters accordingly: tomwalters@0: handles=aim_loadpersonal_defaults(handles); % take these anyhow tomwalters@0: tomwalters@0: % the signal in any case: tomwalters@0: handles.all_options.signal=handles.initial_options.signal; tomwalters@0: tomwalters@0: if isfield(handles.initial_options,'pcp') tomwalters@0: handles.info.calculate_pcp=1; tomwalters@0: module_names=fieldnames(handles.initial_options.pcp); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_pcp_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.pcp%s=handles.initial_options.pcp.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'bmm') tomwalters@0: handles.info.calculate_bmm=1; tomwalters@0: module_names=fieldnames(handles.initial_options.bmm); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_bmm_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.bmm.%s=handles.initial_options.bmm.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'nap') tomwalters@0: handles.info.calculate_nap=1; tomwalters@0: module_names=fieldnames(handles.initial_options.nap); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_nap_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.nap.%s=handles.initial_options.nap.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'strobes') tomwalters@0: handles.info.calculate_strobes=1; tomwalters@0: module_names=fieldnames(handles.initial_options.strobes); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_strobes_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.strobes.%s=handles.initial_options.strobes.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'sai') tomwalters@0: handles.info.calculate_sai=1; tomwalters@0: module_names=fieldnames(handles.initial_options.sai); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_sai_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.sai.%s=handles.initial_options.sai.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'usermodule') tomwalters@0: handles.info.calculate_usermodule=1; tomwalters@0: module_names=fieldnames(handles.initial_options.usermodule); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_usermodule_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.usermodule.%s=handles.initial_options.usermodule.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: if isfield(handles.initial_options,'movie') tomwalters@0: handles.info.calculate_movie=1; tomwalters@0: module_names=fieldnames(handles.initial_options.movie); % find out, which module name tomwalters@0: module_name=module_names{1}; % only the first one is relevant! tomwalters@0: handles.info.current_movie_module=module_name; % this one is the current one tomwalters@0: str=sprintf('handles.all_options.movie.%s=handles.initial_options.movie.%s;',module_name,module_name); tomwalters@0: eval(str); tomwalters@0: end tomwalters@0: tomwalters@0: else tomwalters@0: % fill in some parameters for the signal: tomwalters@0: handles.all_options.signal.signal_filename=''; tomwalters@0: handles.all_options.signal.start_time=0; tomwalters@0: handles.all_options.signal.duration=1; tomwalters@0: handles.all_options.signal.samplerate=16000; tomwalters@0: handles=aim_loadpersonal_defaults(handles); tomwalters@0: handles=aim_loadpersonal_defaults(handles); tomwalters@0: return tomwalters@0: end tomwalters@0: else % the parameter file is given as a paramter. So load it! tomwalters@0: tomwalters@0: olddir=pwd; tomwalters@0: [pathstr,name,ext] = fileparts(paramname) tomwalters@0: cd(pathstr); tomwalters@0: eval(name); % here it is evaluated tomwalters@0: cd olddir; tomwalters@0: tomwalters@0: tomwalters@0: handles.all_options=all_options; tomwalters@0: handles=aim_saveparameters(handles,handles.info.parameterfilename); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: