0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % DISPLAYMETHODINFO displays the information about a method in the MATLAB browser.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: DISPLAYMETHODINFO displays the information about a method
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % in the MATLAB browser.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % CALL: displayMethodInfo(className, methodName)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % displayMethodInfo(minfo)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % INPUTS: className: String of the class. For example 'ao'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % methodName: String of the method. For example 'sin'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % minfo: an minfo object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % VERSION: $Id: displayMethodInfo.m,v 1.4 2011/04/08 10:34:01 mauro Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 function varargout = displayMethodInfo(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % Check the inputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 if nargin == 1 && isa(varargin{1}, 'minfo')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 m = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 if nargin ~= 2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 error('### Unknown number of inputs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 elseif ~ischar(varargin{1}) && ~ischar(varargin{2})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 error('### The inputs must be a class name and method name (both Strings)');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 className = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 methodName = varargin{2};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % Get method info object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 m = feval(sprintf('%s.getInfo', className), methodName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 txt = m.tohtml;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % Workaround for the broken anchor tags in the HTML page.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % It is necessary to write the HTML page to disk.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 className = m.mclass;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 if isempty(className)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 className = 'unknown';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 dynamicHelpPath = fullfile(prefdir(), 'dynamicHelp', className);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 if ~exist(dynamicHelpPath, 'dir')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 mkdir(dynamicHelpPath);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 filename = sprintf('%s.html', m.mname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 file = fullfile(dynamicHelpPath, filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 fid = fopen(file, 'w');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 fwrite(fid, txt, 'char');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 fclose(fid);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 web(file, '-new', '-noaddressbox');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 varargout = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 end
|