Script to Run BAP Command Line on Multiple Folders - UVA-CAMA/NICUHDF5Viewer GitHub Wiki
Narayanan wrote the following code to run BAP Command Line on different folders - thanks Narayanan!
Please find the following Matlab code to run BAP on multiple selected directories at once
% Program to run BAP algorithm for various hdf5 files under a given
% directory. The benefit of running this code is that we can analyze the hdf5 files provided in different
% directories in a single run.
% Please provide the list of directories
% The contents of the directories variable should be changed accordingly
% and one can add as many rows as they need. Please note that the each
% directory path is within quotes and separated by a semicolon except the
% last one.
directories = ["C:\Users\Naray\Ann Lurie Childrens Hospital\Research\BAP\111";
"C:\Users\Naray\Ann Lurie Childrens Hospital\Research\BAP\113";
"C:\Users\Naray\Ann Lurie Childrens Hospital\Research\Data\Test"];
len = length(directories);
for i = 1:len
cd(directories(i)); % Changing the path to a particular directory to get the list of hdf5 files
% under that directory
List = dir('**\*.hdf5'); % Listing the files with hdf5 extension
pwd % The present directory is printed just to know which directory is currently running
% The following path is used since the exe file is in that directory
cd('C:\Program Files\University of Virginia\run_all_tagging_algs\application');
for iFile = 1:numel(List)
file_info = [List(iFile).folder, '\', List(iFile).name];
str_a = '"';
str_b = file_info;
str_c = '"';
str_d = ' "[]"';
str_e = ' "[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]"';
run_info = ['run_all_tagging_algs' ' ' str_a str_b str_c str_d str_e];
system(run_info);
clear file_info; clear str_*; clear run_info;
end
clear List;
end