Added parameter saving feature

Script now concatenates simulated parameters to end of an excel sheet, specified at the top. May ran into problems if no matching excel sheet exits.
This commit is contained in:
sakul-45 2021-04-26 22:28:33 +02:00
parent 4a83b50ca0
commit 7f55917f9f
2 changed files with 22 additions and 4 deletions

View File

@ -17,6 +17,8 @@ position3 = [-1250,50,1200,600];
% specify dir for printing figures
figdir = './';
% specifiy excel-file for saving parameters
table_path = 'example_results.xlsx';
%% loading Data
path = input('Path to dataset: ','s');
@ -26,9 +28,9 @@ whos % what variables have been loaded
params % what information is contained in the structure called 'params'
% get name of dataset
dataname = extractBefore(extractAfter(path,asManyOfPattern(wildcardPattern + "/")),'.');
gpuData = gpuArray(Data); % using Parallel Computing toolbox to speed up
dataname = string(extractBefore(extractAfter(path,asManyOfPattern(wildcardPattern + "/")),'.'));
% using Parallel Computing toolbox to speed up (check with "gpuDevice" if you can use this)
gpuData = gpuArray(Data);
%% Baseline Correcting
% plot the raw data & check the number of points before the signal (pre-trigger)
@ -188,7 +190,7 @@ while simu_proceed == 'n'
end
end
%% printing figures and saving parameters
%% printing figures
printing = input('Do you want to print figure(3)? [y/n]: ','s');
if printing == 'y'
figure(3)
@ -197,3 +199,19 @@ if printing == 'y'
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]);
print(gcf,strcat(figdir,dataname),'-dpdf','-r0');
end
%% saving parameters
% concatenate data to existing table
table_old = readtable(table_path);
table_old.Properties.VariableNames = {'filename', 'date', 'pre-trigger', ...
'baseline_points', 'max_area_left', 'max_area_right', 'T_x', 'T_y', 'T_z', ...
'sim. g-value', 'sim_D', 'sim_E', 'sim_lw_gauss', 'sim_lw_lorentz'};
% new data as table
table_new = table(dataname, string(datestr(clock)), pre_trigger, baseline_points, ...
max_region(1), max_region(end), Exp.Temperature(1), Exp.Temperature(2), Exp.Temperature(3), ...
BestSys.g, BestSys.D(1), BestSys.D(2), BestSys.lw(1), BestSys.lw(2), ...
'VariableNames', {'filename', 'date', 'pre-trigger', 'baseline_points', ...
'max_area_left', 'max_area_right', 'T_x', 'T_y', 'T_z', 'sim. g-value', ...
'sim_D', 'sim_E', 'sim_lw_gauss', 'sim_lw_lorentz'});
table_conc = [table_old;table_new];
writetable(table_conc,table_path)

BIN
example_results.xlsx Normal file

Binary file not shown.