-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerateActionMatrix2.m
More file actions
40 lines (30 loc) · 902 Bytes
/
generateActionMatrix2.m
File metadata and controls
40 lines (30 loc) · 902 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
function matrix = generateActionMatrix2( 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=vertcat(matrix, ActionFrame);
end
else
matrix=[];
end
fclose(mFile);
end