% Description: This is an example script which loads complex impulse response results from WaveFarer. % Prerequisite: the Export Complex Impulse Response script was run in WaveFarer which generated a complex-impulse-response.mat file in each Run directory. % Prompt user to enter project and simulation to run dirname=input('Enter project path and name in single quotes: ''[full path directory]\\[name]'':'); outputFileName='complex-impulse-response.mat'; % Check to make sure *.wf extension included (unless user chose .\) if (length(dirname)>2) if ~strcmp(dirname(length(dirname)-2:length(dirname)),'.wf') dirname=[dirname '.wf']; end end simNum=input('Enter simulation to process: '); simNum=sprintf('%06d',simNum); % Add this directory to the matlab path path(path,cd); % CD to the simulation directory eval(['cd ''' dirname '\Simulations\' simNum '''']); % load CIR files simPath = dir([dirname '\Simulations\' simNum]); simPathName = ([dirname '\Simulations\' simNum]); numberOfRuns = sum([simPath.isdir]) - 3; for t=1:numberOfRuns fprintf('Processing Run %i...\n',t); runDir = sprintf('Run%04d',t); load ([simPathName '\' runDir '\' outputFileName]); % The 'load' operation loads all of the variables and data contained in the current % 'Run000X' subdirectory of the user-specified simulation. If multiple % Runs with the same sensors and variables are contained in a % simulation, steps will need to be taken by the user to store each % Run's loaded values separately so they are not overwritten by the values % in subsequent Runs' *.mat files as they are loaded. end cd ..