This is a static copy of a profile report

Home

categorical.ne (Calls: 269115, Time: 3.332 s)
Generated 04-Jun-2021 04:11:26 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\datatypes\categorical\@categorical\ne.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
computecostfunction263523
getrowmostcostfunction2796
getrowcostfunction1398
computenumberfunction1398
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
30
[acodes,bcodes] = reconcileCat...
2691152.024 s60.7%
47
end
2691150.987 s29.6%
34
if acodes > 0 % categorical...
2691150.017 s0.5%
33
if isscalar(acodes) % faster s...
2691150.011 s0.3%
38
end
2691150.011 s0.3%
All other lines  0.282 s8.5%
Totals  3.332 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
@categorical\private\reconcileCategoriesfunction2691151.500 s45.0%
Self time (built-ins, overhead, etc.)  1.832 s55.0%
Totals  3.332 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function47
Non-code lines (comments, blank lines)31
Code lines (lines that can run)16
Code lines that did run8
Code lines that did not run8
Coverage (did run/can run)50.00 %
Function listing
time 
Calls 
 line
   1 
function t = ne(a,b)
   2 
%NE Not equal for categorical arrays.
   3 
%   A ~= B does element by element comparisons between the categorical arrays A
   4 
%   and B and returns an array with elements set to logical 1 (TRUE) where the
   5 
%   relation is true and elements set to logical 0 (FALSE) where it is not. A
   6 
%   and B must have compatible sizes. In the simplest cases, they can be the
   7 
%   same size or one can be a scalar. Two inputs have compatible sizes if, for
   8 
%   every dimension, the dimension sizes of the inputs are either the same or
   9 
%   one of them is 1.
  10 
%
  11 
%   C = NE(A,B) is called for the syntax 'A ~= B'.
  12 
%
  13 
%   If A and B are both ordinal, they must have the same sets of categories,
  14 
%   including their order. If neither A nor B are ordinal, they need not have
  15 
%   the same sets of categories, and the test is performed by comparing the
  16 
%   category names of each pair of elements.
  17 
%
  18 
%   A ~= S or S ~= A, where S is a scalar string or character vector, returns
  19 
%   a logical array the same size as A, containing logical 1 (true) where the
  20 
%   corresponding elements of A are not equal to the category S.
  21 
%
  22 
%   Undefined elements are not comparable to any other categorical values,
  23 
%   including other undefined elements. NE returns logical 1 (true) where
  24 
%   elements of A or B are undefined.
  25 
%
  26 
%   See also EQ.
  27 

  28 
%   Copyright 2006-2020 The MathWorks, Inc.
  29 

  2.024 
 269115 
  30
[acodes,bcodes] = reconcileCategories(a,b,false); 
  31 

  32 
% Undefined elements are not equal to everything.
  0.011 
 269115 
  33
if isscalar(acodes) % faster scalar case 
  0.017 
 269115 
  34
    if acodes > 0 % categorical.undefCode 
  0.011 
 263725 
  35
        t = (acodes ~= bcodes); 
< 0.001 
   5390 
  36
    else 
  0.007 
   5390 
  37
        t = true(size(bcodes)); 
  0.011 
 269115 
  38
    end 
  39 
elseif isscalar(bcodes) % faster scalar case
  40 
    if bcodes > 0 % categorical.undefCode
  41 
        t = (acodes ~= bcodes);
  42 
    else
  43 
        t = true(size(acodes));
  44 
    end
  45 
else
  46 
    t = (acodes ~= bcodes) | (acodes == 0) | (bcodes == 0);
  0.987 
 269115 
  47
end 

Other subfunctions in this file are not included in this listing.