-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_neuron_simulation.m
31 lines (29 loc) · 1.1 KB
/
run_neuron_simulation.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
function run_neuron_simulation(sim_name, options)
%RUN_NEURON_SIMULATION Run the NEURON simulation from MATLAB.
%
% Syntax:
% run_neuron_simulation();
% run_neuron_simulation('sim_name.hoc');
% run_neuron_simulation('sim_name.hoc','Name', value, ...);
%
% Options:
% 'SimulationFolder' = fullfile(pwd,"NEURON/MotorNeuron");
% 'TERMINAL_COMMAND' = "C:\Windows\System32\cmd.exe /c";
% 'NEURON_HOME' = "C:/nrn/bin";
%
% See also: example_load_plot_export_m2_simulations.m
arguments
sim_name {mustBeTextScalar} = 'main_m2_freq_sweep.hoc';
options.SimulationFolder = fullfile(pwd,"NEURON/MotorNeuron");
options.TERMINAL_COMMAND = "C:\Windows\System32\cmd.exe /c";
options.NEURON_HOME = "C:/nrn/bin";
end
nrn_home = strrep(options.NEURON_HOME,"\","/");
sim_folder = strrep(options.SimulationFolder,"\","/");
[root_folder,~,~] = fileparts(sim_folder);
str_to_execute = sprintf("%s/nrniv.bat %s %s %s", root_folder, sim_folder, sim_name, nrn_home);
str_for_terminal = sprintf('%s "%s"', options.TERMINAL_COMMAND, str_to_execute);
simulation_tic = tic;
system(str_for_terminal);
toc(simulation_tic);
end