Skip to content

Commit e9b886b

Browse files
committed
add template functions
1 parent 12e8c8a commit e9b886b

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

src/templates/templateFunction.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
% (C) Copyright 2020 CPP_PTB developpers
2+
3+
function [argout1, argout2] = templateFunction(argin1, argin2, argin3)
4+
%
5+
% Short description of what the function does goes here.
6+
%
7+
% USAGE::
8+
%
9+
% [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3])
10+
%
11+
% :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet,
12+
% consectetur adipiscing elit. Ut congue nec est ac lacinia.
13+
% :type argin1: type
14+
% :param argin2: optional argument and its default value. And some of the
15+
% options can be shown in litteral like ``this`` or ``that``.
16+
% :type argin2: string
17+
% :param argin3: (dimension) optional argument
18+
%
19+
% :returns: - :argout1: (type) (dimension)
20+
% - :argout2: (type) (dimension)
21+
%
22+
% .. todo:
23+
%
24+
% - item 1
25+
% - item 2
26+
27+
% The code goes below
28+
29+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
% (C) Copyright 2020 CPP_PTB developpers
2+
3+
function templateFunctionExample()
4+
% This function illustrates a documentation test defined for MOdox.
5+
% Other than that it does absolutely nothinghort description of what
6+
% the function does goes here.
7+
%
8+
% Examples:
9+
% a=2;
10+
% disp(a)
11+
% % Expected output is prefixed by '%||' as in the following line:
12+
% %|| 2
13+
% %
14+
% % The test continues because no interruption through whitespace,
15+
% % as the previous line used a '%' comment character;
16+
% % thus the 'a' variable is still in the namespace and can be
17+
% % accessed.
18+
% b=3+a;
19+
% disp(a+[3 4])
20+
% %|| [5 6]
21+
%
22+
% % A new test starts here because the previous line was white-space
23+
% % only. Thus the 'a' and 'b' variables are not present here anymore.
24+
% % The following expression raises an error because the 'b' variable
25+
% % is not defined (and does not carry over from the previous test).
26+
% % Because the expected output indicates an error as well,
27+
% % the test passes
28+
% disp(b)
29+
% %|| error('Some error')
30+
%
31+
% % A set of expressions is ignored if there is no expected output
32+
% % (that is, no lines starting with '%||').
33+
% % Thus, the following expression is not part of any test,
34+
% % and therefore does not raise an error.
35+
% error('this is never executed)
36+
%
37+
%
38+
% % tests end here because test indentation has ended
39+
40+
% The code goes below
41+
42+
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
% (C) Copyright 2020 CPP_PTB developpers
2+
3+
function [argout] = templateFunctionNumpy(argin1, argin2, argin3)
4+
%
5+
% Short description of what the function does goes here.
6+
%
7+
% y = templateFunction(argin1, argin2, argin3)
8+
%
9+
% Parameters:
10+
% argin1: The first input value
11+
%
12+
% argin2: The second input value
13+
%
14+
% argin3: The third input value
15+
%
16+
% Returns:
17+
% The input value multiplied by two
18+
19+
% The code goes below
20+
21+
end

0 commit comments

Comments
 (0)