This is a static copy of a profile report

Home

getfield (156 calls, 0.011 sec)
Generated 05-Aug-2011 13:03:48 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/datatypes/getfield.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
structcutfunction156
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
37
f = s.(deblank(strField)); % d...
1560.011 s100.0%
38
return
1560 s0%
36
if (length(varargin)==1 &&...
1560 s0%
35
strField = varargin{1};
1560 s0%
30
if (isempty(varargin))
1560 s0%
All other lines  0 s0%
Totals  0.011 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function59
Non-code lines (comments, blank lines)34
Code lines (lines that can run)25
Code lines that did run5
Code lines that did not run20
Coverage (did run/can run)20.00 %
Function listing
   time   calls  line
1 function f = getfield(s,varargin)
2 %GETFIELD Get structure field contents.
3 % F = GETFIELD(S,'field') returns the contents of the specified
4 % field. This is equivalent to the syntax F = S.field.
5 % S must be a 1-by-1 structure.
6 %
7 % F = GETFIELD(S,{i,j},'field',{k}) is equivalent to the syntax
8 % F = S(i,j).field(k).
9 %
10 % In other words, F = GETFIELD(S,sub1,sub2,...) returns the
11 % contents of the structure S using the subscripts or field
12 % references specified in sub1,sub2,etc. Each set of subscripts in
13 % parentheses must be enclosed in a cell array and passed to
14 % GETFIELD as a separate input. Field references are passed as
15 % strings.
16 %
17 % Note that if the evaluation of the specified subscripts results
18 % in a comma separated list, then GETFIELD will return the value
19 % corresponding to the first element in the comma separated list.
20 %
21 % For improved performance, when getting the value of a simple
22 % field, use <a href="matlab:helpview([docroot '/techdoc/matlab_prog/matlab_prog.map'],'dynamic_field_names')">dynamic field names</a>.
23 %
24 % See also SETFIELD, ISFIELD, FIELDNAMES, ORDERFIELDS, RMFIELD.
25
26 % Copyright 1984-2007 The MathWorks, Inc.
27 % $Revision: 1.21.4.6 $ $Date: 2010/08/23 23:07:49 $
28
29 % Check for sufficient inputs
156 30 if (isempty(varargin))
31 error(message('MATLAB:getfield:InsufficientInputs'))
32 end
33
34 % The most common case
156 35 strField = varargin{1};
156 36 if (length(varargin)==1 && ischar(strField))
0.01 156 37 f = s.(deblank(strField)); % deblank field name
156 38 return
39 end
40
41 f = s;
42 for i = 1:length(varargin)
43 index = varargin{i};
44 if (isa(index, 'cell'))
45 f = f(index{:});
46 elseif ischar(index)
47
48 % Return the first element, if a comma separated list is generated
49 try
50 f = f.(deblank(index)); % deblank field name
51 catch exception %#ok
52 tmp = cell(1,length(f));
53 [tmp{:}] = deal(f.(deblank(index)));
54 f = tmp{1};
55 end
56 else
57 error(message('MATLAB:getfield:InvalidType'));
58 end
59 end

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