-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerateActionMatrix.m
More file actions
39 lines (30 loc) · 892 Bytes
/
generateActionMatrix.m
File metadata and controls
39 lines (30 loc) · 892 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
function matrix = generateActionMatrix( file ,n_frames)
mFile=fopen(file,'r');
if(not(mFile==-1))
matrix=[];
lastDimention=[];
for i=1:n_frames
line=fgets(mFile);
ActionFrame=[];
if(line==-1)
ActionFrame=zeros(1,lastDimention(1)*lastDimention(2));
else
dimension=sscanf(line,'%f %f');
for j=1:dimension(1)
line=fgets(mFile);
strIn='';
for k=1:dimension(2)
strIn=strcat(strIn,'%f');
end
ActionFrame=[ActionFrame textscan(line, strIn, 'delimiter', ' ')];
ActionFrame=cell2mat(ActionFrame);
end
lastDimention=dimension;
end
matrix=horzcat(matrix, ActionFrame);
end
else
matrix=[];
end
fclose(mFile);
end