www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ReplaceAllInstancesofSpecifiedValuesExample.m

    %% Replace All Instances of Specified Values  

%% 
% Create a table containing |Inf| and |'N/A'| to represent missing values. 
dblVar = [NaN;3;Inf;7;9];
cellstrVar = {'one';'three';'';'N/A';'nine'};
charVar = ['A';'C';'E';' ';'I'];
categoryVar = categorical({'red';'yellow';'blue';'violet';''});

A = table(dblVar,cellstrVar,charVar,categoryVar)  

%% 
% Replace all instances of |Inf| with |NaN| and replace all instances of
% |'N/A'| with the empty character vector, |''|. 
B = standardizeMissing(A,{Inf,'N/A'})