-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcarrayRead.m
44 lines (33 loc) · 1016 Bytes
/
mcarrayRead.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
function data = mcarrayRead(datafolder)
% Read all the mocap data in a folder into a struct array
% mcarrayRead(datafolder)
%
% default datafolder = './data/'
%
if nargin == 0
datafolder = ['.' filesep 'data' filesep]; %look in subfolder called 'data'
end
if ~strcmp(datafolder(end),filesep)
%require a slash at the end of the folder path
datafolder = [datafolder filesep];
end
files = dir([datafolder '*.tsv']);
if isempty(files)
files = dir([datafolder '*.mat']);
end
if isempty(files)
files = dir([datafolder '*.c3d']);
end
if isempty(files)
files = dir([datafolder '*.bvh']);
end
if isempty(files)
files = dir([datafolder '*.wii']);
end
if isempty(files)
disp(['Warning: No mocap files found in ' datafolder])
end
for i = 1:length(files)
data(i) = mcread([datafolder files(i).name]);
end
end