Skip to content
Snippets Groups Projects
Commit a5fc8609 authored by leprob001's avatar leprob001
Browse files

Added function that replaces the given value in the dataset by NaN.

parent ae38c66e
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment