time | Calls | line |
---|
| | 1 | function IA = ismissing(A,indicators)
|
| | 2 | %ISMISSING Find missing entries
|
| | 3 | % First argument must be numeric, datetime, duration, calendarDuration,
|
| | 4 | % string, categorical, character array, cell array of character vectors,
|
| | 5 | % a table, or a timetable.
|
| | 6 | % Standard missing data is defined as:
|
| | 7 | % NaN - for double and single floating-point arrays
|
| | 8 | % NaN - for duration and calendarDuration arrays
|
| | 9 | % NaT - for datetime arrays
|
| | 10 | % <missing> - for string arrays
|
| | 11 | % <undefined> - for categorical arrays
|
| | 12 | % blank character [' '] - for character arrays
|
| | 13 | % empty character {''} - for cell arrays of character vectors
|
| | 14 | %
|
| | 15 | % IA = ISMISSING(A) returns a logical array IA indicating the standard
|
| | 16 | % missing values found in A. IA has the same size as A.
|
| | 17 | %
|
| | 18 | % IA = ISMISSING(A,INDICATORS) uses the entries in INDICATORS to specify
|
| | 19 | % which entries of A are treated as missing data. Use INDICATORS to find
|
| | 20 | % non-standard missing values. If A is an array, INDICATORS must be a
|
| | 21 | % vector. If A is a table, INDICATORS can also be a cell with entries of
|
| | 22 | % different types.
|
| | 23 | %
|
| | 24 | % Double entries in INDICATORS match double, single, integer, and logical
|
| | 25 | % entries in A. Single, integer, and logical entries in INDICATORS match
|
| | 26 | % single, integer, and logical entries in A, respectively.
|
| | 27 | %
|
| | 28 | % String, character, and cell array of character vectors INDICATORS match
|
| | 29 | % string entries in A.
|
| | 30 | %
|
| | 31 | % Character, duration, and datetime entries in INDICATORS match
|
| | 32 | % character, duration, and datetime entries in A, respectively.
|
| | 33 | %
|
| | 34 | % String and character INDICATORS also match categorical entries in A.
|
| | 35 | %
|
| | 36 | % You can include NaN, NaT, the missing string, the empty character '',
|
| | 37 | % or '<undefined>' in INDICATORS to also find standard missing values.
|
| | 38 | %
|
| | 39 | % Integers cannot store NaN, therefore you must include a special unused
|
| | 40 | % integer value in INDICATORS to find missing integer data in A.
|
| | 41 | %
|
| | 42 | % Examples:
|
| | 43 | %
|
| | 44 | % % IA is TRUE for the entries of A that are NaN
|
| | 45 | % A = [NaN 1 2 NaN NaN 3]
|
| | 46 | % IA = ismissing(A)
|
| | 47 | %
|
| | 48 | % % IA is TRUE for the entries of A that are missing strings
|
| | 49 | % A = string({'Mercury','Gemini'}); A(5) = 'Apollo'
|
| | 50 | % IA = ismissing(A)
|
| | 51 | %
|
| | 52 | % % Find both standard (NaN and <undefined>) and non-standard
|
| | 53 | % % (-99 and '--') missing entries in table T.
|
| | 54 | % % Use the '' indicator to find the <undefined> categorical entry.
|
| | 55 | % temperature = [21.1 21.5 NaN 23.1 25.7 24.1 25.3 NaN 24.1 25.5]';
|
| | 56 | % windSpeed = [12.9 13.3 12.1 13.5 10.9 -99 -99 12.2 10.8 17.1]';
|
| | 57 | % windDirection = categorical({'W' 'SW' 'SW' '' 'SW' 'S' ...
|
| | 58 | % 'S' 'SW' 'SW' 'SW'})';
|
| | 59 | % conditions = {'PTCLDY' '--' '--' 'PTCLDY' 'FAIR' 'CLEAR' ...
|
| | 60 | % 'CLEAR' 'FAIR' 'PTCLDY' 'MOSUNNY'}';
|
| | 61 | % T = table(temperature,windSpeed,windDirection,conditions)
|
| | 62 | % IT = ismissing(T,{NaN -99 '' '--'})
|
| | 63 | %
|
| | 64 | % See also FILLMISSING, RMMISSING, STANDARDIZEMISSING, ISNAN, ISNAT,
|
| | 65 | % ISOUTLIER, ISLOCALMAX, ISLOCALMIN, ISCHANGE
|
| | 66 |
|
| | 67 | % Copyright 2012-2017 The MathWorks, Inc.
|
| | 68 |
|
< 0.001 | 2 | 69 | if nargin <= 1
|
0.002 | 2 | 70 | IA = matlab.internal.math.ismissingKernel(A);
|
| | 71 | else
|
| | 72 | IA = matlab.internal.math.ismissingKernel(A,indicators,false);
|
< 0.001 | 2 | 73 | end
|