This is a static copy of a profile report

Home

varNamesDim>varNamesDim.moveProps (Calls: 4, Time: 0.003 s)
Generated 04-Jun-2021 04:11:15 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

Parents (calling functions)

Function NameFunction TypeCalls
varNamesDim>varNamesDim.assignIntoclass method4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
282
target.descrs = repmat({''},1,...
20.000 s17.6%
283
target.descrs(toLocs) = source...
20.000 s11.6%
278
target.descrs(toLocs) = {''};
20.000 s7.3%
342
target.hasCustomProps = (numel...
40.000 s6.1%
317
for ii = 1:numel(fn) % in targ...
40.000 s6.0%
All other lines  0.001 s51.4%
Totals  0.003 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
repmatfunction20.000 s7.7%
Self time (built-ins, overhead, etc.)  0.002 s92.3%
Totals  0.003 s100% 
Code Analyzer results
Line numberMessage
Coverage results
Show coverage for parent directory
Total lines in function91
Non-code lines (comments, blank lines)26
Code lines (lines that can run)65
Code lines that did run26
Code lines that did not run39
Coverage (did run/can run)40.00 %
Function listing
time 
Calls 
 line
 253 
        function target = moveProps(target,source,fromLocs,toLocs)
 254 
            import matlab.tabular.Continuity
 255 
            
< 0.001 
      4 
 256
            if target.hasUnits 
 257 
                if source.hasUnits
 258 
                    % Replace the specified target units with the source's
 259 
                    target.units(toLocs) = source.units(fromLocs);
 260 
                else
 261 
                    % Replace the specified target units with defaults
 262 
                    target.units(toLocs) = {''};
 263 
                end
< 0.001 
      4 
 264
            elseif source.hasUnits 
 265 
                % Create property in target, assign source values into it
 266 
                target.units = repmat({''},1,target.length);
 267 
                target.units(toLocs) = source.units(fromLocs);
 268 
                target.hasUnits = true;
< 0.001 
      4 
 269
            else 
 270 
                % Neither has units, leave it alone
< 0.001 
      4 
 271
            end 
< 0.001 
      4 
 272
            if target.hasDescrs 
< 0.001 
      2 
 273
                if source.hasDescrs 
 274 
                    % Replace the specified target descrs with the source's
 275 
                    target.descrs(toLocs) = source.descrs(fromLocs);
      2 
 276
                else 
 277 
                    % Replace the specified target descrs with defaults
< 0.001 
      2 
 278
                    target.descrs(toLocs) = {''}; 
< 0.001 
      2 
 279
                end 
< 0.001 
      2 
 280
            elseif source.hasDescrs 
 281 
                % Create property in target, assign source descrs into it
< 0.001 
      2 
 282
                target.descrs = repmat({''},1,target.length); 
< 0.001 
      2 
 283
                target.descrs(toLocs) = source.descrs(fromLocs); 
< 0.001 
      2 
 284
                target.hasDescrs = true; 
 285 
            else
 286 
                % Neither has descrs, leave it alone
< 0.001 
      4 
 287
            end 
< 0.001 
      4 
 288
            if target.hasContinuity 
 289 
                if source.hasContinuity
 290 
                    % Replace the specified target descrs with the source's
 291 
                    target.continuity(toLocs) = source.continuity(fromLocs);
 292 
                else
 293 
                    % Replace the specified target descrs with defaults
 294 
                    target.continuity(toLocs) = 'unset';
 295 
                end
< 0.001 
      4 
 296
            elseif source.hasContinuity 
 297 
                % Create property in target, assign source descrs into it
 298 
                target.continuity = repmat(Continuity.unset,1,target.length);
 299 
                target.continuity(toLocs) = source.continuity(fromLocs);
 300 
                target.hasContinuity = true;             
< 0.001 
      4 
 301
            else 
 302 
                % Neither has continuity, leave it alone
< 0.001 
      4 
 303
            end 
 304 
            % CustomProperties
 305 
            % For CustomProps in target tCP:
 306 
            % * If source also has them, just copy over for specific locations
 307 
            % * If source is empty or doesn't have property, replace with default values in
 308 
            % specific locations
 309 
            % For CustomProperties in Source but not target:
 310 
            % * create default of the right length, and copy over values
 311 
            % * If it's empty, just copy it over
 312 
            import matlab.internal.datatypes.defaultarrayLike
< 0.001 
      4 
 313
            tn = fieldnames(target.customProps); 
< 0.001 
      4 
 314
            sn = fieldnames(source.customProps); 
< 0.001 
      4 
 315
            fn = [tn; sn]; 
< 0.001 
      4 
 316
            try 
< 0.001 
      4 
 317
                for ii = 1:numel(fn) % in target 
 318 
                    if isfield(source.customProps, fn{ii}) %  in source
 319 
                        if ~isequal(size(source.customProps.(fn{ii})),[0,0]) % not empty [] in source
 320 
                            if ~isfield(target.customProps, fn{ii}) || isequal(size(target.customProps.(fn{ii})),[0,0]) % not in target or [] in target: fill target's vars with source's default
 321 
                                target.customProps.(fn{ii}) = defaultarrayLike([1,target.length],'like', source.customProps.(fn{ii}),false);
 322 
                            end 
 323 
                            % whether or not source field is in target, now copy over source data 
 324 
                            target.customProps.(fn{ii})(toLocs) = source.customProps.(fn{ii})(fromLocs);
 325 
                        else % empty [] in source   
 326 
                            if ~isfield(target.customProps, fn{ii}) || isequal(size(target.customProps.(fn{ii})),[0,0]) % not in target or [] in target: create name and [] in target
 327 
                                target.customProps.(fn{ii}) = [];
 328 
                            else % Target has data: Lengthen if necessary, filling with target defaults.
 329 
                                target.customProps.(fn{ii})(toLocs) = defaultarrayLike([1,1],'like', target.customProps.(fn{ii}),false);
 330 
                            end
 331 
                        end
 332 
                    else % in target, not in source
 333 
                        if ~isequal(size(target.customProps.(fn{ii})),[0,0]) % Target has data: Lengthen if necessary, filling with target defaults.
 334 
                            target.customProps.(fn{ii})(toLocs) = defaultarrayLike([1,1],'like', target.customProps.(fn{ii}),false);
 335 
                        % (else: empty in target, not in source: no-op)
 336 
                        end
 337 
                    end
 338 
                end
 339 
            catch ME
 340 
                throw(addCause(MException(message('MATLAB:table:CustomProperties:IncompatibleTypes',class(target.customProps.(fn{ii})),class(source.customProps.(fn{ii})),fn{ii})),ME))
< 0.001 
      4 
 341
            end 
< 0.001 
      4 
 342
            target.hasCustomProps = (numel(fn) > 0); 
< 0.001 
      4 
 343
        end 

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