This is a static copy of a profile report

Home

tabularDimension>tabularDimension.setLabels (Calls: 24, Time: 0.040 s)
Generated 16-Jul-2020 17:09:52 using performance time.
class method in file /Applications/MATLAB_R2020a.app/toolbox/matlab/datatypes/tabular/+matlab/+internal/+tabular/+private/tabularDimension.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...ension>tabularDimension.createLikeclass method16
tabular.setPropertyfunction8
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
234
obj = obj.validateAndAssignLab...
240.036 s90.4%
219
indices = 1:obj.length;
240.001 s3.1%
208
if nargin < 4
240.001 s1.3%
218
if fullAssignment % replacing ...
240.000 s0.9%
217
fullAssignment = (nargin == 2)...
240.000 s0.4%
All other lines  0.002 s3.9%
Totals  0.040 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...t;varNamesDim.validateAndAssignLabelsclass method80.019 s48.1%
...t;rowNamesDim.validateAndAssignLabelsclass method160.014 s35.0%
Self time (built-ins, overhead, etc.)  0.007 s16.9%
Totals  0.040 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function41
Non-code lines (comments, blank lines)16
Code lines (lines that can run)25
Code lines that did run17
Code lines that did not run8
Coverage (did run/can run)68.00 %
Function listing
time 
Calls 
 line
 195 
        function obj = setLabels(obj,newLabels,subscripts,fixDups,fixEmpties,fixIllegal)
 196 
            %SETLABELS Modify, overwrite, or remove a tabularDimension's labels.
< 0.001 
     24 
 197
            if isstring(newLabels) 
 198 
                % cannot use convertStringsToChars because scalar string
 199 
                % must convert to cellstr, not char vector.
 200 
                newLabels = cellstr(newLabels);
< 0.001 
     24 
 201
            end 
< 0.001 
     24 
 202
            if nargin < 6 
 203 
                % Should illegal labels be modified to make them legal?
< 0.001 
     24 
 204
                fixIllegal = false; 
< 0.001 
     24 
 205
                if nargin < 5 
 206 
                    % Should empty labels be filled in wth default labels?
< 0.001 
     24 
 207
                    fixEmpties = false; 
< 0.001 
     24 
 208
                    if nargin < 4 
 209 
                        % Should duplicate labels be made unique?
< 0.001 
     24 
 210
                        fixDups = false; 
< 0.001 
     24 
 211
                    end 
< 0.001 
     24 
 212
                end 
< 0.001 
     24 
 213
            end 
 214 
                        
 215 
            % Subscripts equal to [] denotes a full assignment while the edge case of a
 216 
            % partial assignment to zero labels requires a 1x0 or 0x1 empty.
< 0.001 
     24 
 217
            fullAssignment = (nargin == 2) || isequal(subscripts,[]); 
< 0.001 
     24 
 218
            if fullAssignment % replacing all labels 
  0.001 
     24 
 219
                indices = 1:obj.length; 
 220 
            elseif obj.hasLabels % replacing some labels
 221 
                indices = obj.subs2inds(subscripts);
 222 
                if islogical(indices)
 223 
                    % subs2inds leaves logical untouched, validateAndAssignLabels requires indices
 224 
                    indices = find(indices);
 225 
                end
 226 
            else % don't allow a subscripted assignment to an empty label property
 227 
                assert(false,'Partial/Subscripted assignment to empty label is not supported');
< 0.001 
     24 
 228
            end 
 229 
            
 230 
            % Check the type of the new labels, and convert them to the canonical type as
 231 
            % necessary (and allowed). If this is a full assignment of a 0x0, and removing
 232 
            % the labels is allowed, validateLabels leaves the shape alone, otherwise it
 233 
            % reshapes to a vector of the appropriate orientation.
  0.036 
     24 
 234
            obj = obj.validateAndAssignLabels(newLabels,indices,fullAssignment,fixDups,fixEmpties,fixIllegal); 
< 0.001 
     24 
 235
        end 

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