% This function is part of the NMSM Pipeline, see file for full license.
%
% This function removes markers from the model that are not in the list of
% kept markers.
%
% (model, array of string) -> None
% remove markers not in the list of kept markers
function removeNonUsedMarkers(model, keptMarkerNames)
toBeRemoved = [];
for i=0:model.getMarkerSet().getSize()-1
markerName = model.getMarkerSet().get(i).getName();
if(~markerIncluded(keptMarkerNames, markerName))
toBeRemoved(length(toBeRemoved) + 1) = i;
end
end
markerSet = model.updMarkerSet();
for i=1:length(toBeRemoved)
markerSet.remove(toBeRemoved(length(toBeRemoved)-i+1));
end
end