This is a static copy of a profile reportHome
opaque.double (4982 calls, 0.197 sec)
Generated 05-Aug-2011 13:02:24 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/datatypes/@opaque/double.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 |
13 | dbl = builtin('double', opaque... | 4982 | 0.087 s | 44.4% |  |
12 | if ~isjava(opaque_array) | 4982 | 0.055 s | 27.8% |  |
14 | return; | 4982 | 0.011 s | 5.6% |  |
All other lines | | | 0.044 s | 22.2% |  |
Totals | | | 0.197 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
Line number | Message |
38 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
51 | FINDSTR will be removed in a future release. Use STRFIND instead. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 90 |
Non-code lines (comments, blank lines) | 34 |
Code lines (lines that can run) | 56 |
Code lines that did run | 3 |
Code lines that did not run | 53 |
Coverage (did run/can run) | 5.36 % |
Function listing
time calls line
1 function dbl = double(opaque_array)
2 %DOUBLE Convert a Java object to DOUBLE
3
4 % Chip Nylander, June 1998
5 % Copyright 1984-2007 The MathWorks, Inc.
6 % $Revision: 1.9.4.5 $ $Date: 2007/12/06 13:29:42 $
7
8 %
9 % For opaque types other than those programmed here, just run the default
10 % builtin double function.
11 %
0.05 4982 12 if ~isjava(opaque_array)
0.09 4982 13 dbl = builtin('double', opaque_array);
0.01 4982 14 return;
15 end
16
17 %
18 % Convert opaque array to cell array to get the items in it.
19 %
20
21 try
22 cel = cell(opaque_array);
23 catch exception %#ok
24 dbl = [];
25 return;
26 end
27
28
29 sz = builtin('size', cel);
30 psz = prod(sz);
31
32 %
33 % An empty Java array becomes an empty double array.
34 %
35 if psz == 0
36 try
37 dbl = reshape([],size(cel));
38 catch
39 dbl = [];
40 end
41 return;
42 end;
43
44 %
45 % A java.lang.Number array becomes a double array.
46 %
47 dbl = zeros(sz);
48 t = opaque_array(1);
49 c = class(t);
50
51 while ~isempty(findstr(c,'[]'))
52 t = t(1);
53 c = class(t);
54 end
55
56 if psz == 1 && isnumeric(t)
57 dbl = double(t);
58 return;
59 end
60
61 if isa(t,'java.lang.Number')
62 for i=1:psz
63 if isa(cel{i}, 'java.lang.Object')
64 dbl(i) = doubleValue(cel{i});
65 else
66 dbl(i) = cel{i};
67 end
68 end
69 return;
70 end
71
72 %
73 % Run toDouble on each Java object in the MATLAB array. This will error
74 % out if a toDouble method is not available for the Java class of the object.
75 %
76 if psz == 1
77 if ~isjava(opaque_array(1))
78 dbl = builtin('double', opaque_array(1));
79 else
80 dbl = toDouble(opaque_array(1));
81 end
82 else
83 for i = 1:psz
84 if ~isjava(cel{i})
85 dbl(i) = toDouble(cel{i});
86 else
87 dbl(i) = toDouble(cel{i});
88 end;
89 end;
90 end;