From 1c89fdc78d930f94608b02f5cc9d90062491a226 Mon Sep 17 00:00:00 2001 From: Thomas Guillod Date: Fri, 24 Apr 2020 18:52:20 +0200 Subject: [PATCH] Zip workflow Zip all the simulations and remove the FEM folder. Having thousands of file in a folder is a mess (file explorer, search, etc.) --- .../inductor_fem_ann/+fem_ann/get_zip.m | 25 +++++++++++++++++++ .../inductor_fem_ann/master_assemble.m | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 source_inductor/inductor_fem_ann/+fem_ann/get_zip.m diff --git a/source_inductor/inductor_fem_ann/+fem_ann/get_zip.m b/source_inductor/inductor_fem_ann/+fem_ann/get_zip.m new file mode 100644 index 0000000..34258ec --- /dev/null +++ b/source_inductor/inductor_fem_ann/+fem_ann/get_zip.m @@ -0,0 +1,25 @@ +function get_zip(folder_fem) +% Assemble many FEM simulation into a zip file and remove the folder. +% +% Parameters: +% folder_fem (str): path of the folder where the results are stored +% +% (c) 2019-2020, ETH Zurich, Power Electronic Systems Laboratory, T. Guillod + +% get MATLAB file in the directory +filelist = dir([folder_fem filesep() '*.mat']); +assert(isempty(filelist)==false, 'invalid data') + +% get name +file_fem = [folder_fem '.zip']; +for i=1:length(filelist) + filelist_cell{i} = [filelist(i).folder filesep() filelist(i).name]; +end + +% zip data +zip(file_fem, filelist_cell); + +% remove folder +[s, m] = rmdir(folder_fem, 's'); + +end diff --git a/source_inductor/inductor_fem_ann/master_assemble.m b/source_inductor/inductor_fem_ann/master_assemble.m index 2c4509f..e2f64a7 100644 --- a/source_inductor/inductor_fem_ann/master_assemble.m +++ b/source_inductor/inductor_fem_ann/master_assemble.m @@ -18,6 +18,9 @@ function master_assemble(file_assemble, folder_fem) fprintf('assemble\n') [diff, n_tot, n_sol, model_type, file_model, inp, out_fem] = fem_ann.get_assemble(folder_fem); +fprintf('zip\n') +fem_ann.get_zip(folder_fem); + % compute the analytical results fprintf('approx\n') out_approx = fem_ann.get_out_approx(model_type, inp);