Skip to main content

updateDesignVariables.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function takes the primary values (values maintained between
% optimization rounds) and updates them based on the secondary values from
% an individual round of optimization. The params included dictate which
% primary values are updated.
%
% (2D Array of number, Array of number, Array of boolean) -> (struct)
% Updates the primary values from the optimized round secondary values


function newPrimaryValues = updateDesignVariables(primaryValues, ...
secondaryValues, isIncluded)
% newPrimaryValues = zeros(size(primaryValues));
for i=1:length(isIncluded)
if(isIncluded(i))
[startIndex, endIndex] = findIsIncludedStartAndEndIndex( ...
primaryValues, isIncluded, i);
newPrimaryValues{i} = secondaryValues(startIndex:endIndex);
else
newPrimaryValues{i} = primaryValues{i};
end
end
end