This is a static copy of a profile report

Home

substruct (Calls: 788, Time: 0.006 s)
Generated 04-Jun-2021 04:11:14 using performance time.
function in file C:\Program Files\MATLAB\R2020b\toolbox\matlab\datatypes\substruct.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
tabular.subsrefParensfunction3
tabular.subsasgnDotfunction785
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
33
s.type = type;
7880.002 s36.8%
34
s.subs = subs;
7880.002 s26.5%
37
end
7880.000 s3.9%
29
elseif rem(nlevels,1)
7880.000 s3.2%
27
if nlevels < 1
7880.000 s1.0%
All other lines  0.002 s28.7%
Totals  0.006 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function37
Non-code lines (comments, blank lines)26
Code lines (lines that can run)11
Code lines that did run8
Code lines that did not run3
Coverage (did run/can run)72.73 %
Function listing
time 
Calls 
 line
   1 
function s = substruct(type,subs,varargin)
   2 
%SUBSTRUCT Create structure argument for SUBSREF or SUBSASGN.
   3 
%    S = SUBSTRUCT(TYPE1,SUBS1,TYPE2,SUBS2,...) creates a structure with
   4 
%    the fields required by an overloaded SUBSREF or SUBSASGN method. Each
   5 
%    TYPE must be one of '.', '()', or '{}'.  The corresponding SUBS
   6 
%    argument must be either a field name (for the '.' type) or a cell
   7 
%    array containing the index vectors (for the '()' or '{}' types).  The
   8 
%    output S is a structure array containing the fields:
   9 
%       type -- subscript types '.', '()', or '{}'
  10 
%       subs -- actual subscript values (field names or cell arrays
  11 
%               of index vectors)
  12 
%
  13 
%    For example, to call SUBSREF with parameters equivalent to the syntax
  14 
%       B = A(i,j).field
  15 
%    use
  16 
%       S = substruct('()',{i j},'.','field');
  17 
%       B = subsref(A,S);
  18 
%    Similarly,
  19 
%       subsref(A, substruct('()',{1:2, ':'}))  performs  A(1:2,:)
  20 
%       subsref(A, substruct('{}',{1 2 3}))     performs  A{1,2,3}.
  21 
%
  22 
%    See also SUBSREF, SUBSASGN, NUMARGUMENTSFROMSUBSCRIPT.
  23 

  24 
%       Copyright 1984-2019 The MathWorks, Inc.
  25 

< 0.001 
    788 
  26
nlevels = nargin / 2; 
< 0.001 
    788 
  27
if nlevels < 1 
  28 
   error(message('MATLAB:substruct:nargin'))
< 0.001 
    788 
  29
elseif rem(nlevels,1) 
  30 
   error(message('MATLAB:substruct:narginOdd'))
< 0.001 
    788 
  31
end 
  32 

  0.002 
    788 
  33
s.type = type; 
  0.002 
    788 
  34
s.subs = subs; 
< 0.001 
    788 
  35
if nlevels > 1 
  36 
    s(2:nlevels) = struct('type',varargin(1:2:end),'subs',varargin(2:2:end));
< 0.001 
    788 
  37
end