-
Notifications
You must be signed in to change notification settings - Fork 1
/
createIzhikevichModel.m
50 lines (32 loc) · 1.02 KB
/
createIzhikevichModel.m
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
clc;
close all;
clear;
function new_model(modelname)
% NEW_MODEL Create a new, empty Simulink model
% NEW_MODEL('MODELNAME') creates a new model with
% the name 'MODELNAME'. Without the 'MODELNAME'
% argument, the new model is named 'my_untitled'.
if nargin == 0
modelname = 'new_model';
elseif (isfile(modelname))
fprintf('Model already exists...');
break
end
% create and open the model
open_system(new_system(modelname));
// % set default screen color
// set_param(modelname,'ScreenColor','green');
% set default solver
set_param(modelname,'Solver','ode3');
% set default stoptime
set_param(modelname,'StopTime','12');
% save the model
save_system(modelname);
end
model_name = "";
new_model(model_name);
load_system(model_name);
add_block('simulink/Sources/Sine Wave', strcat(model_name, '/Sine1'));
set_param('mymodel/Sine1','position',[140,80,180,120]);
add_block('simulink/Sources/In1','mymodel/Subsystem1/In2');
https://uk.mathworks.com/help/simulink/ug/approach-modeling-programmatically.html#butkll8