-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWriteListOfMovies.m
49 lines (41 loc) · 1.53 KB
/
WriteListOfMovies.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
47
48
49
% filename='T:\Lab Members\Ben Isaacoff\Data\1_17_18\movies2Bfit.txt';
%
% dir1='T:\Lab Members\Ben Isaacoff\Data\1_17_18';
% dir2='T:\Lab Members\Ben Isaacoff\Data\1_22_18';
% dir3='T:\Lab Members\Ben Isaacoff\Data\1_26_18';
% dir4='T:\Lab Members\Ben Isaacoff\Data\1_27_18';
filename='T:\Lab Members\Ben Isaacoff\Data\2_23_18\movies2Bfit_backwards.txt';
dir1='T:\Lab Members\Ben Isaacoff\Data\2_23_18';
dir2='T:\Lab Members\Ben Isaacoff\Data\3_02_18';
%% List all the movies
%dir1
files=dir([dir1,filesep,'mov_*.mat']);
files(cellfun('length',{files.name})~=12)=[];
%dir2
tfiles=dir([dir2,filesep,'mov_*.mat']);
tfiles(cellfun('length',{tfiles.name})~=12)=[];
%concatenate the file structures
files=[files;tfiles];
%dir3
% tfiles=dir([dir3,filesep,'mov_*.mat']);
% tfiles(cellfun('length',{tfiles.name})~=11)=[];
% %concatenate the file structures
% files=[files;tfiles];
% %dir4
% tfiles=dir([dir4,filesep,'mov_*.mat']);
% tfiles(cellfun('length',{tfiles.name})~=11)=[];
% %concatenate the file structures
% files=[files;tfiles];
% check for outliers in filesize
allbytes=cell2mat({files.bytes});
outind=find(abs(allbytes-median(allbytes))>(0.1*median(allbytes)));
if ~isempty(outind)
warning(['Possible non-movie file included in movie list: ',...
files(outind).folder,filesep,files(outind).name])
end
%% Write the files in a list to a .txt file
fid=fopen(filename,'w');
for ii=fliplr(1:length(files))
fprintf(fid,'%s \r\n',[files(ii).folder,filesep,files(ii).name]);
end
fclose(fid);