From 7f55917f9f653cfcc5956e2e18717dfb05af5b02 Mon Sep 17 00:00:00 2001 From: sakul-45 <81963567+sakul-45@users.noreply.github.com> Date: Mon, 26 Apr 2021 22:28:33 +0200 Subject: [PATCH] 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. --- EPR_script.m | 26 ++++++++++++++++++++++---- example_results.xlsx | Bin 0 -> 3135 bytes 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 example_results.xlsx diff --git a/EPR_script.m b/EPR_script.m index 5b7c4f9..d207223 100644 --- a/EPR_script.m +++ b/EPR_script.m @@ -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) diff --git a/example_results.xlsx b/example_results.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..7f6af964441a818dbb5c9b72cd6f07e3dea5bc8a GIT binary patch literal 3135 zcmZ`*2{=>>8y<$4FpZ@l*%BEv69y4NmdMDY#>F>l0+Hk}%AWYO;=HVy>>pP6(xY zn=U5HQ1+d)AzisNM3%Ut`#*m-|NYN-p7TBDJm>w+^S$5s-tV=w2J*oG0KhIl@q_HM zn1;4YC=UQ22Lu52aG&DM0{lZf{6h$K;g>vuoz$-Q5$k9j7?y^}iRfmIL^B2_A4dy0 z<1BD8U09>@VD(%2M{lbwxmHy%(+`vr4y18|;ENVmKjnP3sHt7&Ux9yiF2wK{-Y1LP$F0a7nG>;zk#A&Uv~hP^Il?Tx%Qr<%Te7;n4Z z+L{($-*O>+Hue1k=j+*bxP)W-83>HC2+wF3#QW|L_|w<|7ThKDDiUb>1ARRon0)uR zv`KI&6yiogkOwhXU2XfCm}~;2Xu!-XdpDRcCrLLIVuAoZ7F;}qmGX-2vu_?7E0El) zrmVFH#~!(rGXgZzp5!Cm5|h+F!3;dtP-hST?d~7o_sj}XNNTanM5qZ$VmX$b`BFXY zjwzP(95N+CwIla2-G?T%dLOxREK<|?g?kP}DlNui`m|tQqSql!h~o<9OBZZ+?3pVH zp^s*Ilbb8~svhnY86^olx&P%4=dYk2i?KASz4e@1gd#5hAjOSWi0Xg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