-
Notifications
You must be signed in to change notification settings - Fork 3
/
SpatializeDynamicParameters.m
49 lines (45 loc) · 1.86 KB
/
SpatializeDynamicParameters.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
%% Spatialize dynamic parameters of the model. To supports inhomogeneiety
% accross the cortical surface.
%
% ARGUMENTS:
% options -- An initialised BrainNetworkModels options structure.
% TheseParameters -- cell array of strings specifying parameters
% to spatialise
%
% OUTPUT:
% options -- input with requested parameters spatialised...
%
% REQUIRES:
% none
%
% USAGE:
%{
%For epilepsy work...
TheseParameters = {'nu_se'};
options = SpatializeDynamicParameters(options, TheseParameters);
%}
%
% MODIFICATION HISTORY:
% SAK(24-10-2010) -- Original.
% SAK(Nov 2013) -- Move to git, future modification history is
% there...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function options = SpatializeDynamicParameters(options, TheseParameters)
%% Set defaults for any argument that weren't specified
if nargin<2,
error(['BrainNetworkModels:' mfilename ':ParamtersMustBeSpecified'],'The parameters you want Spatialized must be specified...');
end
for k = 1:length(TheseParameters),
if ~isnumeric(options.Dynamics.(TheseParameters{k})),
error(['BrainNetworkModels:' mfilename ':OnlyDefinedForNumericTypes'], ['The requested parameter ''' TheseParameters{k} ''' is not numeric... This operation doesn''t make sense for non-numeric.']);
end
end
%% Do the stuff...
for k = 1:length(TheseParameters),
if numel(options.Dynamics.(TheseParameters{k}))==1, %Check not already done
options.Dynamics.(TheseParameters{k}) = repmat(options.Dynamics.(TheseParameters{k}), [1 options.Connectivity.NumberOfVertices]);
else
warning(['BrainNetworkModels:' mfilename ':AlreadySpatialised'], ['The requested parameter ''' TheseParameters{k} '''has already been spatialised ...']);
end
end
end %function SpatializeDynamicParameters()