This is a static copy of a profile report

Home

repmat (Calls: 813, Time: 0.145 s)
Generated 04-Jun-2021 04:11:11 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\elmat\+matlab\+internal\+builtinhelper\repmat.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...riable>readTextSpreadsheetVariablesubfunction8
FastVarOpts>FastVarOpts.FastVarOptsclass method6
...rtOptions>ImportOptions.setvartypeclass method2
...nsion>tabularDimension.emptyLabelsclass method2
varNamesDim>varNamesDim.movePropsclass method2
tabular.tabular>tabular.createVariablesclass method2
tabular.subsasgnParensfunction785
table.table>table.tableclass method6
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
63
B = A(ones(siz(1), 1), :);
7870.096 s66.4%
58
if isscalar(A) && ~iso...
8130.017 s11.9%
60
elseif ismatrix(A) && ...
7870.012 s8.0%
61
[m,n] = size(A);
7870.006 s4.0%
51
siz(idx) = double(full(checkSi...
16060.005 s3.1%
All other lines  0.010 s6.6%
Totals  0.145 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
tabular.subsreffunction7850.081 s55.8%
tabular.sizefunction23550.009 s6.4%
repmat>checkSizesTypesubfunction16160.003 s1.8%
Self time (built-ins, overhead, etc.)  0.052 s36.1%
Totals  0.145 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function83
Non-code lines (comments, blank lines)35
Code lines (lines that can run)48
Code lines that did run25
Code lines that did not run23
Coverage (did run/can run)52.08 %
Function listing
time 
Calls 
 line
   1 
function B = repmat(A,varargin)
   2 
%REPMAT Replicate and tile an array.
   3 
%   B = repmat(A,M,N) creates a large matrix B consisting of an M-by-N
   4 
%   tiling of copies of A. The size of B is [size(A,1)*M, size(A,2)*N].
   5 
%   The statement repmat(A,N) creates an N-by-N tiling.
   6 
%
   7 
%   B = REPMAT(A,[M N]) accomplishes the same result as repmat(A,M,N).
   8 
%
   9 
%   B = REPMAT(A,[M N P ...]) tiles the array A to produce a
  10 
%   multidimensional array B composed of copies of A. The size of B is
  11 
%   [size(A,1)*M, size(A,2)*N, size(A,3)*P, ...].
  12 
%
  13 
%   REPMAT(A,M,N) when A is a scalar is commonly used to produce an M-by-N
  14 
%   matrix filled with A's value and having A's CLASS. For certain values,
  15 
%   you may achieve the same results using other functions. Namely,
  16 
%      REPMAT(NAN,M,N)           is the same as   NAN(M,N)
  17 
%      REPMAT(SINGLE(INF),M,N)   is the same as   INF(M,N,'single')
  18 
%      REPMAT(INT8(0),M,N)       is the same as   ZEROS(M,N,'int8')
  19 
%      REPMAT(UINT32(1),M,N)     is the same as   ONES(M,N,'uint32')
  20 
%      REPMAT(EPS,M,N)           is the same as   EPS(ONES(M,N))
  21 
%
  22 
%   Example:
  23 
%       repmat(magic(2), 2, 3)
  24 
%       repmat(uint8(5), 2, 3)
  25 
%
  26 
%   Class support for input A:
  27 
%      float: double, single
  28 
%      integer: uint8, int8, uint16, int16, uint32, int32, uint64, int64
  29 
%      char, logical
  30 
%
  31 
%   See also BSXFUN, MESHGRID, ONES, ZEROS, NAN, INF.
  32 

  33 
%   Copyright 1984-2020 The MathWorks, Inc.
  34 

< 0.001 
    813 
  35
if nargin <= 2 
< 0.001 
     10 
  36
    M = varargin{1}; 
< 0.001 
     10 
  37
    checkSizesType(M); 
< 0.001 
     10 
  38
    if isscalar(M) 
  39 
        siz = [M M];
< 0.001 
     10 
  40
    elseif ~isempty(M) && isrow(M) 
< 0.001 
     10 
  41
        siz = M; 
  42 
    else
  43 
        error(message('MATLAB:repmat:invalidReplications'));
< 0.001 
     10 
  44
    end 
< 0.001 
     10 
  45
    siz = double(full(siz)); 
< 0.001 
    803 
  46
else % nargin > 2 
  0.001 
    803 
  47
    siz = zeros(1,nargin-1); 
< 0.001 
    803 
  48
    for idx = 1:nargin-1 
  0.001 
   1606 
  49
        arg = varargin{idx}; 
< 0.001 
   1606 
  50
        if isscalar(arg) 
  0.005 
   1606 
  51
            siz(idx) = double(full(checkSizesType(arg))); 
  52 
        else
  53 
            error(message('MATLAB:repmat:invalidReplications'));
< 0.001 
   1606 
  54
        end 
< 0.001 
   1606 
  55
    end 
< 0.001 
    813 
  56
end 
  57 

  0.017 
    813 
  58
if isscalar(A) && ~isobject(A) 
  0.001 
     26 
  59
    B = A(ones(siz,'int8')); 
  0.012 
    787 
  60
elseif ismatrix(A) && numel(siz) == 2 
  0.006 
    787 
  61
    [m,n] = size(A); 
< 0.001 
    787 
  62
    if (m == 1 && siz(2) == 1) 
  0.096 
    787 
  63
        B = A(ones(siz(1), 1), :); 
  64 
    elseif (n == 1 && siz(1) == 1)
  65 
        B = A(:, ones(siz(2), 1));
  66 
    else
  67 
        mind = (1:m)';
  68 
        nind = (1:n)';
  69 
        mind = mind(:,ones(1,siz(1)));
  70 
        nind = nind(:,ones(1,siz(2)));
  71 
        B = A(mind,nind);
< 0.001 
    787 
  72
    end 
  73 
else
  74 
    Asiz = size(A);
  75 
    Asiz = [Asiz ones(1,length(siz)-length(Asiz))];
  76 
    siz = [siz ones(1,length(Asiz)-length(siz))];
  77 
    subs = cell(1,length(Asiz));
  78 
    for i=length(Asiz):-1:1
  79 
        ind = (1:Asiz(i))';
  80 
        subs{i} = ind(:,ones(1,siz(i)));
  81 
    end
  82 
    B = A(subs{:});
  0.001 
    813 
  83
end 

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