function [replacedData] = replaceValuesWithNaN(pDataset, pValue) %REPLACEVALUESWITHNAN Replaces the given value by NaN in the dataset. % % Parameters: % pDataset (double) The dataset that should be modified. % pValue (double) The value that should be replaced by NaN. % % Returns: % replacedData The dataset with replaced values. %% Initialization replacedData = false; %% Parameter check if ~isnumeric(pDataset) || ~isnumeric(pValue) warning([mfilename ': At least one parameter is not numeric! Returning false!']); return; end pDataset(pDataset == pValue) = NaN; replacedData = pDataset; end