-
Notifications
You must be signed in to change notification settings - Fork 2
/
manipulate_Ra.m
36 lines (33 loc) · 1.08 KB
/
manipulate_Ra.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
function neuron = manipulate_Ra(neuron,boolean,regions)
% changes Ra in a tree region by a factor of 1e7 in order to exclude it from any
% current exchange (boolean = 1 ). Boolean = 0 reverses the change
if nargin < 3
regions = {'all'};
end
if ~iscell(regions)
regions = {regions};
end
if nargin < 2
boolean = 1;
end
if boolean
scale = 1000000;
else
scale = 1/1000000;
end
for t = 1:numel(neuron.mech)
fields = fieldnames(neuron.mech{t});
if ~any(strcmp(regions,'all'))
fields = intersect(fields,regions); % only take the specified regions
end
for f1 = 1:numel(fields)
if ~isfield(neuron.mech{t}.(fields{f1}),'pas')
if isfield(neuron.mech{t}.all,'pas')
neuron.mech{t}.(fields{f1}).pas = neuron.mech{t}.all.pas;
else
error('cannot manipulate Ra because mechanism "pas" does neither exist in this region nor defined for all regions')
end
end
neuron.mech{t}.(fields{f1}).pas.Ra = neuron.mech{t}.(fields{f1}).pas.Ra * scale;
end
end