-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexampleTemplate.m
More file actions
34 lines (28 loc) · 768 Bytes
/
exampleTemplate.m
File metadata and controls
34 lines (28 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
md = Markdown('exampleTemplateFilled.md');
md.CreateFile();
md.AppendTemplate('exampleTemplate.md');
% replace tag with arbitrary text
md.ReplaceText('Text1','Here be', 'dragons');
% replace array
a = round(rand(1,6)*100);
md.ReplaceArray('Array1', a);
% replace matrix
m = round(rand(3,3)*100);
md.ReplaceMatrix('Matrix1', m);
% replace struct
myStruct = struct();
myStruct.Name = 'Example struct';
myStruct.Property = {'Here', 'be', 2, 'dragons'};
myStruct.OtherProperty = 1;
myStruct.AnotherProperty = [1 2 3 4];
md.ReplaceStruct('Struct1', myStruct);
% replace figure
x = linspace(0,2 * pi);
plot(x,sin(x), 'LineWidth', 2);
hold on;
plot(x,cos(x), 'LineWidth', 2);
hold off;
xlim([0, 2 * pi]);
xlabel('rad');
md.ReplaceFigure('Figure1', gcf);
md.CloseFile();