-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmc_load_data.m
More file actions
41 lines (35 loc) · 797 Bytes
/
mc_load_data.m
File metadata and controls
41 lines (35 loc) · 797 Bytes
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
function [data,errors] = mc_load_data(Template,subs,varargin)
flatten = 1;
if (nargin>2)
flatten = varargin{1};
end
N = length(subs);
Subject = subs{1};
tmp = mc_load_datafile(mc_GenPath(Template));
s = size(tmp);
s2 = [N s];
data = zeros(s2);
if (flatten)
tmp = reshape(tmp,1,numel(tmp));
data = reshape(data,N,prod(s));
data(1,:) = tmp;
else
%need to generalize this to N-d data
data(1,:,:,:) = tmp;
end
errors = cell(N,1);
for i = 2:N
Subject = subs{i};
fprintf(1,'%d of %d\n',i,N);
[tmppath,errors{i}] = mc_GenPath(Template);
if (~isempty(errors{i}))
continue;
end
tmp = mc_load_datafile(tmppath);
if (flatten)
tmp = reshape(tmp,1,numel(tmp));
data(i,:) = tmp;
else
data(i,:,:,:) = tmp;
end
end