You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-14Lines changed: 50 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,25 @@ Matlab-Templates is a collection of functions for quickly generating pre-edited
4
4
for specific use cases: creating new classes, new tests...
5
5
It is based on the 'tedit' function, originally written by Peter Bodin.
6
6
7
-
Each function in the template has a name in the 'newXXX' format.
8
-
When the function is called with the name of the item, a new file is created, and the editor opens
7
+
The main functions are:
8
+
9
+
***newClass**: create a new file containing a class definition template
10
+
***newTest**: create a new file containing a minimal implementation for running unit tests
11
+
***newEnum**: create a new file containing a minimal implementation for an enumeration class
12
+
13
+
Each function has to be called with the name of the item to create.
14
+
This creates a new file (based on the item name), and opens the editor
9
15
with a pre-edited header and code structure.
10
-
In particular, author name, copyright information, date of creation... are automatically updated.
11
-
The templates can be modified by editing the 'newXXX' functions.
16
+
In particular, author name, copyright information, date of creation... are automatically populated
17
+
based on the templates defined in the 'newXXX' functions.
12
18
19
+
## Installation
13
20
14
-
## Main functions
21
+
The library is composed of a single directory containing all the necessary functions.
22
+
The installation can be performed by simply cloning (or extracting the archive),
23
+
and adding the path to the library to the Matlab path list.
15
24
16
-
###Creating new class
25
+
## Creating a new class
17
26
18
27
The newClass function can be used to create a new file containing a class definition.
19
28
@@ -26,16 +35,10 @@ The new file contains the following code patterns:
26
35
* a constructor stub
27
36
* space for specific methods
28
37
29
-
### Creating new test
30
-
31
-
The newTest function can be used to create a new file containing a minimal implementation for running unit tests.
32
-
33
-
newTest(FUNCTIONTOTEST)
34
-
35
38
36
-
## Class pattern example
39
+
###Class pattern example
37
40
38
-
The following is the result of the creation of a new class called `SampleClass`, using the `newClass('SampleClass')` command:
41
+
The following is the result of the creation of a new file called `SampleClass.m`, defining the class `SampleClass`, using the command `newClass('SampleClass')`:
39
42
40
43
classdef SampleClass < handle
41
44
% One-line description here, please.
@@ -77,3 +80,36 @@ The following is the result of the creation of a new class called `SampleClass`
77
80
end % end classdef
78
81
79
82
83
+
## Creating new test
84
+
85
+
The newTest function can be used to create a new file containing a minimal implementation for running unit tests.
86
+
87
+
newTest(FUNCTIONTOTEST)
88
+
89
+
The following is the result of the command `newTest('foo')`:
0 commit comments