-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFlySongReSegmenter.m
More file actions
40 lines (29 loc) · 936 Bytes
/
FlySongReSegmenter.m
File metadata and controls
40 lines (29 loc) · 936 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
%Batch Fly Song Analysis
function FlySongReSegmenter(out_folder)
% ReSegment fly song, e.g. using new params
%
% out_file: full path to daq_name_out_folder
%
[poolavail,isOpen] = check_open_pool;
%check if _out folder exists
folder = out_folder;
if ~isdir(folder)
error('myApp:argChk','Analysis stopped.\nFolder with previously segmented song does not exist.');
end
%get _out folder info
dir_list = dir(folder);
file_num = numel(dir_list);
for y = 1:file_num
file = dir_list(y).name; %pull out the file name
[~,root,ext] = fileparts(file);
path_file = [folder '/' file];
if strcmp(ext,'.mat');
%load data
load(path_file,'Data')
%Run FlySongSegmenter
[Data, Sines, Pulses, Params] = FlySongSegmenter(Data.d,[],[]);
%Save results back in same file
save(path_file,'Data','Sines','Pulses','Params','-v7.3');
end
end
check_close_pool(poolavail,isOpen);