varNamesDim>varNamesDim.setUnits (Calls: 2, Time: 0.001 s)
Generated 04-Jun-2021 04:11:13 using performance time.
class method in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\datatypes\tabular\+matlab\+internal\+tabular\+private\varNamesDim.m
Copy to new window for comparing multiple runs
Function Name | Function Type | Calls |
tabular.setProperty | function | 2 |
Line Number | Code | Calls | Total Time | % Time | Time Plot |
557 | if ~matlab.internal.datatypes.... | 2 | 0.001 s | 57.3% | |
572 | obj.hasUnits = false; | 2 | 0.000 s | 8.2% | |
577 | obj.units = newUnits; | 2 | 0.000 s | 7.4% | |
570 | elseif isempty(newUnits) | 2 | 0.000 s | 6.5% | |
556 | if (nargin<3) || (nargin==3... | 2 | 0.000 s | 6.3% | |
All other lines | 0.000 s | 14.3% | |||
Totals | 0.001 s | 100% |
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
isText | function | 2 | 0.000 s | 35.2% | |
Self time (built-ins, overhead, etc.) | 0.001 s | 64.8% | |||
Totals | 0.001 s | 100% |
Line number | Message |
Total lines in function | 24 |
Non-code lines (comments, blank lines) | 3 |
Code lines (lines that can run) | 21 |
Code lines that did run | 14 |
Code lines that did not run | 7 |
Coverage (did run/can run) | 66.67 % |
time | Calls | line | |
---|---|---|---|
555 | function obj = setUnits(obj,newUnits,noErrorCheck) | ||
< 0.001 | 2 | 556 | if (nargin<3) || (nargin==3 && ~noErrorCheck) |
< 0.001 | 2 | 557 | if ~matlab.internal.datatypes.isText(newUnits,true) % require a cell array, allow empty character vectors |
558 | error(message('MATLAB:table:InvalidUnits')); | ||
< 0.001 | 2 | 559 | elseif ~isempty(newUnits) && numel(newUnits) ~= obj.length |
560 | error(message('MATLAB:table:IncorrectNumberOfUnits')); | ||
2 | 561 | end | |
2 | 562 | end | |
563 | |||
< 0.001 | 2 | 564 | if isstring(newUnits) |
565 | newUnits = cellstr(newUnits); | ||
2 | 566 | end | |
< 0.001 | 2 | 567 | if obj.length == 0 && isequal(size(newUnits),[1 0]) |
568 | % leave a 1x0 cell alone for a table with no vars | ||
569 | obj.hasUnits = true; | ||
< 0.001 | 2 | 570 | elseif isempty(newUnits) |
< 0.001 | 2 | 571 | newUnits = {}; % for cosmetics |
< 0.001 | 2 | 572 | obj.hasUnits = false; |
573 | else | ||
574 | newUnits = strtrim(newUnits(:))'; % a row vector | ||
575 | obj.hasUnits = true; | ||
< 0.001 | 2 | 576 | end |
< 0.001 | 2 | 577 | obj.units = newUnits; |
< 0.001 | 2 | 578 | end |
Other subfunctions in this file are not included in this listing.