NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/util/calls.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 function [varargout] = calls(theFcn, varargin)
2
3 % calls -- List of function calls.
4 %  calls('demo') demonstrates itself by listing the
5 %   routines that would be called by "bessel(2, 1)".
6 %  [...] = calls('theFcn', ...) executes 'theFcn' with
7 %       the given arguments, then displays the list of M-file
8 %   routines that were called, according to the Matlab
9 %   "which" function.  The list is also placed in the
10 %   caller's "ans".  If the list is empty, then all
11 %   the calls were made to "built-in" functions.
12 %
13 % NOTE: When using this routine to assist a bundling
14 %  procedure, be sure not to include files whose
15 %  respective copyrights would be violated.
16  
17 % Copyright (C) 2000 Dr. Charles R. Denham, ZYDECO.
18 %  All Rights Reserved.
19 %   Disclosure without explicit written consent from the
20 %    copyright owner does not constitute publication.
21  
22 % Version of 18-Apr-2000 09:11:50.
23 % Updated    18-Apr-2000 09:46:21.
24
25 if nargout > 0, varargout = cell(1, nargout); end
26
27 if nargin < 1, help(mfilename), theFcn = 'demo'; end
28
29 if isequal(theFcn, 'demo')
30         calls('bessel', 2, 1)
31         return
32 end
33
34 clear functions
35
36 if nargout > 0
37         if nargin > 1
38                 [varargout{:}] = feval(theFcn, varargin{:});
39         else
40                 [varargout{:}] = feval(theFcn);
41         end
42 else
43         if nargin > 1
44                 feval(theFcn, varargin{:});
45         else
46                 feval(theFcn);
47         end
48 end
49
50 theCalled = inmem;
51
52 for i = 1:length(theCalled)
53         theCalled{i} = which(theCalled{i});
54 end
55
56 w = which(mfilename);
57 for i = length(theCalled):-1:1
58         if isequal(w, theCalled{i})
59                 theCalled(i) = [];
60                 break
61         end
62 end
63
64 if isempty(theCalled)
65         theCalled = '    (none)';
66 end
67
68 assignin('caller', 'ans', theCalled)
69 disp(' ')
70 disp([' ## M-files called by "' theFcn '":'])
71 disp(' ')
72 disp(theCalled)
73
74 clear functions
Note: See TracBrowser for help on using the browser.