This is a static copy of a profile report

Home

attributes>findSupportedAttr (Calls: 2, Time: 0.001 s)
Generated 04-Jun-2021 04:11:07 using performance time.
subfunction in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\lang\+matlab\+internal\+validators\attributes.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
attributes>checkAttrssubfunction2
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
135
attributor = @(A, fname, msgId...
20.000 s18.6%
134
case 'scalartext'
20.000 s5.5%
192
end
20.000 s0.1%
123
case 'nonsparse'
20.000 s0.1%
119
case 'column'
20.000 s0.1%
All other lines  0.001 s75.5%
Totals  0.001 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function100
Non-code lines (comments, blank lines)10
Code lines (lines that can run)90
Code lines that did run21
Code lines that did not run69
Coverage (did run/can run)23.33 %
Function listing
time 
Calls 
 line
  93 
function [ attributor ] = findSupportedAttr( attr, isAttributeScalar)
  94 

  95 
% attribute not found value
< 0.001 
      2 
  96
attributor = []; 
  97 

  98 
% attribute must be a char
< 0.001 
      2 
  99
if isstring( attr ) 
 100 
    attr = char(attr);
< 0.001 
      2 
 101
elseif ~ischar( attr ) 
 102 
    return;
      2 
 103
end 
 104 

< 0.001 
      2 
 105
switch attr 
< 0.001 
      2 
 106
    case '2d' 
 107 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @ismatrix, A, 'twod', fname, 'expected2D', msgId, argname, argpos);
< 0.001 
      2 
 108
    case '3d' 
 109 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @(x)(ndims(x) <= 3), A, 'threed', fname, 'expected3D', msgId, argname, argpos);
< 0.001 
      2 
 110
    case 'square' 
 111 
        fcn =  @(x) (ismatrix(x) && (size(x,1) == size(x,2)));
 112 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor(fcn, A, 'square', fname, 'expectedSquare', msgId, argname, argpos);
< 0.001 
      2 
 113
    case 'scalar' 
 114 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @isscalar, A, 'scalar', fname, 'expectedScalar', msgId, argname, argpos);
< 0.001 
      2 
 115
    case 'vector' 
 116 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @isvector, A, 'vector', fname, 'expectedVector', msgId, argname, argpos);
< 0.001 
      2 
 117
    case 'row' 
 118 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @isrow, A, 'row', fname, 'expectedRow', msgId, argname, argpos);
< 0.001 
      2 
 119
    case 'column' 
 120 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @iscolumn, A, 'column', fname, 'expectedColumn', msgId, argname, argpos);
< 0.001 
      2 
 121
    case 'nonempty' 
 122 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @(x)~isempty(x), A, 'nonempty', fname, 'expectedNonempty', msgId, argname, argpos);
< 0.001 
      2 
 123
    case 'nonsparse' 
 124 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @(x)~issparse(x), A, 'nonsparse', fname, 'expectedNonsparse', msgId, argname, argpos);
< 0.001 
      2 
 125
    case 'nonzero' 
 126 
        fcn = @(x)(isnumeric(x) || islogical(x)) && ~isempty(x) && nnz(x)==numel(x);
 127 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'nonzero', fname, 'expectedNonZero', msgId, argname, argpos);
< 0.001 
      2 
 128
    case 'binary' 
 129 
        fcn = @(x)(islogical(x) || (isnumeric(x)) && all( x(:)==0 | x(:)==1 ));
 130 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'binary', fname, 'expectedBinary', msgId, argname, argpos);
< 0.001 
      2 
 131
    case 'integer' 
 132 
        fcn = @(x)islogical(x) || (isnumeric(x) && isreal(x) && all(isfinite(x(:))) && all(floor(x(:))==x(:)));
 133 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'integer', fname, 'expectedInteger', msgId, argname, argpos);
< 0.001 
      2 
 134
    case 'scalartext' 
< 0.001 
      2 
 135
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( @(x) (isa(x,'string') && isscalar(x) && ~ismissing(x)) || (ischar(x) && size(x,1)<=1), A, 'scalartext', fname, 'expectedScalartext', msgId, argname, argpos); 
 136 
    case 'finite'
 137 
        fcn = @(x) all(isfinite(x(:)));
 138 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'finite', fname, 'expectedFinite', msgId, argname, argpos);
 139 
    case 'nonnan'
 140 
        fcn = @(x) ~any(isnan(x(:))); 
 141 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'nonnan', fname, 'expectedNonNaN', msgId, argname, argpos);      
 142 
        
 143 
        % value related attributes most be real numeric, regardless of CLASSES
 144 
    case 'odd'
 145 
        fcn = @(x)(isnumeric(x) || islogical(x) ) && isreal(x) && all( mod(x(:),2)==1 );
 146 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'odd', fname, 'expectedOdd', msgId, argname, argpos);
 147 
    case 'even'
 148 
        fcn = @(x)(isnumeric(x) || islogical(x) ) && isreal(x) && all( mod(x(:),2)==0 );
 149 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'even', fname, 'expectedEven', msgId, argname, argpos);
 150 
    case 'positive'
 151 
        fcn = @(x)(isnumeric(x) || islogical(x) ) && isreal(x) && ~any( x(:)<=0 );
 152 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'positive', fname, 'expectedPositive', msgId, argname, argpos);
 153 
    case 'nonnegative'
 154 
        fcn = @(x)(isnumeric(x) || islogical(x) ) && isreal(x) && ~any( x(:)<0 );
 155 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'nonnegative', fname, 'expectedNonnegative', msgId, argname, argpos);
 156 
    case 'real'
 157 
        % if it is not numeric, it is real
 158 
        fcn = @(x)~isnumeric(x) || isreal(x);
 159 
        attributor = @(A, fname, msgId, argname, argpos )valueAttributor( fcn, A, 'real', fname, 'expectedReal', msgId, argname, argpos);
 160 
    case 'diag'
 161 
        attributor = @(A, fname,msgId, argname, argpos)diagAttributor( A, 'diag', fname, 'expectedDiag', msgId, argname, argpos);  
 162 
    case 'size'
 163 
        attributor = @(A,v,fname,msgId, argname, argpos)sizeAttributor(A,v,fname, 'incorrectSize', msgId, argname, argpos);
 164 
    case 'ndims'
 165 
        attributor = @(A,v,fname,msgId, argname, argpos)dimsAttributor(A, v, attr, fname, 'incorrectNumdims', msgId, argname, argpos, isAttributeScalar);
 166 
    case 'numel'
 167 
        attributor = @(A,v,fname,msgId, argname, argpos)sizeTypeAttributor( @numel, A, v, attr, fname, 'incorrectNumel', msgId, argname, argpos, isAttributeScalar);
 168 
    case 'nrows'
 169 
        attributor = @(A,v,fname,msgId, argname, argpos)sizeTypeAttributor( @(x)size(x,1), A, v, attr, fname, 'incorrectNumrows', msgId, argname, argpos, isAttributeScalar);
 170 
    case 'ncols'
 171 
        attributor = @(A,v,fname,msgId, argname, argpos)sizeTypeAttributor( @(x)size(x,2), A, v, attr, fname, 'incorrectNumcols', msgId, argname, argpos, isAttributeScalar);
 172 
    case '<'
 173 
        attributor = @(A,v, fname, msgId, argname, argpos)relationalAttributor( @lt,A,v,attr,fname,'notLess',msgId, argname, argpos, isAttributeScalar);
 174 
    case '<='
 175 
        attributor = @(A,v, fname, msgId, argname, argpos)relationalAttributor( @le,A,v,attr,fname,'notLessEqual',msgId, argname, argpos, isAttributeScalar);
 176 
    case '>'
 177 
        attributor = @(A,v, fname, msgId, argname, argpos)relationalAttributor( @gt,A,v,attr,fname,'notGreater',msgId, argname, argpos, isAttributeScalar);
 178 
    case '>='
 179 
        attributor = @(A,v, fname, msgId, argname, argpos)relationalAttributor( @ge,A,v,attr,fname,'notGreaterEqual',msgId, argname, argpos, isAttributeScalar);
 180 
    case 'increasing'
 181 
        attributor = @(A, fname, msgId, argname, argpos)monotonicAttributor(@gt,A,attr,fname,'expectedIncreasing',msgId, argname, argpos);
 182 
    case 'decreasing'
 183 
        attributor = @(A, fname, msgId, argname, argpos)monotonicAttributor(@lt,A,attr,fname,'expectedDecreasing',msgId, argname, argpos);
 184 
    case 'nonincreasing'
 185 
        attributor = @(A, fname, msgId, argname, argpos)monotonicAttributor(@le,A,attr,fname,'expectedNonincreasing',msgId, argname, argpos);
 186 
    case 'nondecreasing'
 187 
        attributor = @(A, fname, msgId, argname, argpos)monotonicAttributor(@ge,A,attr,fname,'expectedNondecreasing',msgId, argname, argpos);    
 188 
    case '_mxprimitive'
 189 
        attributor = @(A, fname, msgId, argname, argpos)valueAttributor(@(~) false, A, 'builtin', fname, 'expectedBuiltin', msgId, argname, argpos);
< 0.001 
      2 
 190
end 
 191 

< 0.001 
      2 
 192
end 

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