function [LoadingRateArray, StandardErrorArray, ConfidenceIntervalArray] = doOneParameter(ovenObj, MOTobj, BeamName, BeamParameter, ParameterArray) Beams = MOTobj.Beams; Beam = Beams{cellfun(@(x) strcmpi(x.Alias, BeamName), Beams)}; NumberOfPointsForParam = length(ParameterArray); LoadingRateArray = zeros(1,NumberOfPointsForParam); StandardErrorArray = zeros(1,NumberOfPointsForParam); ConfidenceIntervalArray = zeros(NumberOfPointsForParam, 2); for i=1:NumberOfPointsForParam eval(sprintf('Beam.%s = %d;', BeamParameter, ParameterArray(i))); [LoadingRateArray(i), StandardErrorArray(i), ConfidenceIntervalArray(i,:)] = MOTobj.runSimulation(ovenObj); end if MOTobj.DoSave LoadingRate = struct; LoadingRate.Values = LoadingRateArray; LoadingRate.Errors = StandardErrorArray; LoadingRate.CI = ConfidenceIntervalArray; MOTobj.Results = LoadingRate; SaveFolder = [MOTobj.SaveDirectory filesep 'Results']; Filename = ['OneParameterScan_' datestr(now,'yyyymmdd_HHMM')]; eval([sprintf('%s_Object', Filename) ' = MOTobj;']); mkdir(SaveFolder); save([SaveFolder filesep Filename], sprintf('%s_Object', Filename)); end end