This is a static copy of a profile reportHome
timer.set (2 calls, 0.031 sec)
Generated 15-Mar-2007 12:01:49 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\matlab\iofun\@timer\set.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
122 | set(obj.jobject,varargin{:}); | 2 | 0.016 s | 50.0% |  |
121 | ans = []; | 2 | 0.000 s | 0.0% |  |
120 | else | 2 | 0.000 s | 0.0% |  |
139 | end | 2 | 0 s | 0% |  |
138 | warning(backTraceState); | 2 | 0 s | 0% |  |
Other lines & overhead | | | 0.016 s | 50.0% |  |
Totals | | | 0.031 s | 100% | |
Children (called functions)
M-Lint results
Line number | Message |
121 | Using ANS as a variable is not recommended as ANS is frequently overwritten by MATLAB. |
123 | Using ANS as a variable is not recommended as ANS is frequently overwritten by MATLAB. |
124 | The variable 'out' can apparently be used before it is defined. |
Coverage results
[ Show coverage for parent directory ]
Total lines in file | 140 |
Non-code lines (comments, blank lines) | 76 |
Code lines (lines that can run) | 64 |
Code lines that did run | 17 |
Code lines that did not run | 47 |
Coverage (did run/can run) | 26.56 % |
Function listing
time calls line
1 function output = set(obj,varargin)
2 %SET Configure or display timer object properties.
3 %
4 % SET(OBJ) displays property names and their possible values for all
5 % configurable properties of timer object OBJ. OBJ must be a single
6 % timer object.
7 %
8 % PROP_STRUCT = SET(OBJ) returns the property names and their
9 % possible values for all configurable properties of timer object OBJ.
10 % OBJ must be a single timer object. The return value, PROP_STRUCT, is a
11 % structure whose field names are the property names of OBJ, and whose
12 % values are cell arrays of possible property values or empty cell arrays
13 % if the property does not have a finite set of possible string values.
14 %
15 % SET(OBJ,'PropertyName') displays the possible values
16 % for the specified property, PropertyName, of timer object OBJ.
17 % OBJ must be a single timer object.
18 %
19 % PROP_CELL = SET(OBJ,'PropertyName') returns the possible values
20 % for the specified property, PropertyName, of timer object OBJ.
21 % OBJ must be a single timer object. The returned array, PROP_CELL,
22 % is a cell array of possible value strings or an empty cell
23 % array if the property does not have a finite set of possible
24 % string values.
25 %
26 % SET(OBJ,'PropertyName',PropertyValue,...) configures the property,
27 % PropertyName, to the specified value, PropertyValue, for timer
28 % object OBJ. You can specify multiple property name/property
29 % value pairs in a single statement. OBJ can be a single timer
30 % object or a vector of timer objects, in which case SET configures
31 % the property values for all the timer objects specified.
32 %
33 % SET(OBJ,S) configures the properties of OBJ, with the values specified
34 % in S, where S is a structure whose field names are object
35 % property names.
36 %
37 % SET(OBJ,PN,PV) configures the properties specified in the cell array
38 % of strings, PN, to the corresponding values in the cell array
39 % PV, for the timer object OBJ. PN must be a vector. If OBJ is an
40 % array of timer objects, PV can be an M-by-N cell array, where M
41 % is equal to the length of the timer object array and N is equal to
42 % the length of PN. In this case, each timer object is updated with
43 % a different set of values for the list of property names contained
44 % in PN.
45 %
46 % Param-value string pairs, structures, and param-value cell array pairs
47 % may be used in the same call to SET.
48 %
49 % Example:
50 % t = timer;
51 % set(t) % Display all configurable properties and their possible values
52 % set(t, 'ExecutionMode') % Display all possible values of property
53 % set(t, 'TimerFcn', 'callbk', 'ExecutionMode', 'FixedRate')
54 % set(t, {'StartDelay', 'Period'}, {30, 30})
55 % set(t, 'Name', 'MyTimerObject')
56 %
57 % See also TIMER, TIMER/GET.
58 %
59
60 % RDD 11-20-2001
61 % Copyright 2001-2005 The MathWorks, Inc.
62 % $Revision: 1.4.4.6 $ $Date: 2005/06/21 19:34:57 $
63
2 64 if ~isa(obj,'timer')
65 try
66 builtin('set',obj,varargin{:})
67 catch
68 %This will ensure that we do not printout details of where error
69 %occured.
70 err = lasterror;
71 newerr.message = err.message;
72 newerr.identifier = err.identifier;
73 rethrow(newerr);
74 end
75 return;
76 end
77
78 % Error if invalid object(s) are given.
2 79 if ~all(isvalid(obj))
80 error('MATLAB:timer:invalid',timererror('MATLAB:timer:invalid'));
81 end
82
2 83 if ( (nargin==1) && (nargout == 0) ) % e.g., 'set(OBJ)'
84 % calling builtin set function
85 out = set(obj.jobject);
86 fields = fieldnames(out); % get settable property names
87 for lcv=1:length(fields) % foreach property, print line in std. 'set' output
88 field = out.(fields{lcv});
89 fprintf([blanks(4) fields{lcv}]); % print the prop. name
90 if ~isempty(strfind(fields{lcv}, 'Fcn')),
91 % We have an '...Fcn' property.
92 fprintf(': string -or- function handle -or- cell array\n');
93 elseif (isempty(field)) % if field enum values is [], must not be enum; end line here.
94 fprintf('\n');
95 else
96 % list enum values in format [ {default} option2 option3... ]
97 fprintf([': ' formatEnum(field) '\n']);
98 end
99 end
2 100 else
2 101 backTraceState = warning('query','backtrace');
2 102 warning off backtrace;
2 103 [pNames pVals] = getSettableValues(obj); % store off the values in case of error
2 104 try
2 105 if (nargout == 0) % e.g., "set(OBJ,'PN',PV,....)"
2 106 if nargin == 2 && ischar(varargin{1}) % e.g., "set(OBJ,'PN')"
107 jObj = obj.jobject;
108 out = set(jObj, varargin{:});
109 % Get fully qualified property name.
110 hProp = findprop(jObj, varargin{:});
111 if ~isempty(strfind(hProp.Name, 'Fcn')),
112 % We have an '...Fcn' property.
113 fprintf('string -or- function handle -or- cell array\n');
114 elseif isempty(out),
115 propHandle = findprop(jObj, varargin{1});
116 fprintf(timererror('MATLAB:timer:propnotenumtype', propHandle.Name));
117 else
118 fprintf([formatEnum(out) '\n']);
119 end
< 0.01 2 120 else
< 0.01 2 121 ans = [];
0.02 2 122 set(obj.jobject,varargin{:});
2 123 if ~isempty(ans) % if set returned something in ans, pass it on.
124 output = out;
125 end
2 126 end
127 else % e.g., "OPT=set(OBJ)"
128 output = set(obj.jobject,varargin{:});
129 end
130 catch
131 % restore the original backtrace state
132 warning(backTraceState);
133 lerr = fixlasterr;
134 resetValues(obj,pNames, pVals); % restore all previoud values upon error
135 error(lerr{:});
136 end
137 % restore the original backtrace state
2 138 warning(backTraceState);
2 139 end
140
Other subfunctions in this file are not included in this listing.