-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathfrequencies.m
46 lines (39 loc) · 1.18 KB
/
frequencies.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
function res = frequencies(this, ind, f)
% Method for getting/setting frequencies of TF data
% FORMAT res = frequencies(this, ind, values)
% _________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% Stefan Kiebel
% $Id: frequencies.m 5079 2012-11-25 18:38:18Z vladimir $
if nargin >1
if ~isnumeric(ind)
ind = 1:nfrequencies(this);
end
end
if nargin < 3
if strncmpi(transformtype(this), 'TF',2)
res = this.transform.frequencies;
else
res = [];
return
end
if exist('ind', 'var') == 1
res = res(ind);
end
else
if ~strncmpi(transformtype(this), 'TF',2)
error('Frequencies can only be assigned to a TF dataset');
end
if any(f) <= 0 || any(~isnumeric(f))
error('Frequencies must be positive numbers');
end
if length(ind)~=length(f) || max(ind)>size(this, 2)
error('Wrong frequency axis or indices');
end
if length(ind) == size(this.data, 2)
this.transform.frequencies = f;
else
this.transform.frequencies(ind) = f;
end
res = this;
end