-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfdb_add.m
49 lines (41 loc) · 1.08 KB
/
fdb_add.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
% fdb = fdb_add(fdb)
%
% Recursively add all available fit sequences in the subfolders of the
% working directory.
%
%
% fdb = fdb_add(fdb,folders)
%
% Adding fit sequences in folders
%
% folders string
% or cell of foldernames
function fdb = fdb_add(fdb,folders)
if ~exist('fdb','var') || isempty(fdb)
fdb = fdb_init;
end
if ~exist('folders','var') || isempty(folders)
if exist('Results','dir')
[~, ~, folders] = fileChooser('./Results', [], -1);
folders = strcat('Results',filesep,folders);
else
[~,folders] = list_files_recursive([],'folders');
end
end
if ischar(folders)
folders = {folders};
end
N0 = length(fdb.fits.chi2s);
for f=1:length(folders)
file = [folders{f},filesep,'workspace.mat'];
[~,name] = fileparts(fileparts(fileparts(folders{f})));
close all
try
fprintf('%s ...',file);
fdb = fdb_add_file(fdb,file,name);
catch ERR
file
rethrow(ERR)
end
end
fprintf('\n ############ fdb_add: %i fits sequences added. ###########\n',length(fdb.fits.chi2s)-N0);