From 43184cd02fbb29025426a4e51100a0d344fd9296 Mon Sep 17 00:00:00 2001 From: sakul-45 <81963567+sakul-45@users.noreply.github.com> Date: Sat, 24 Jul 2021 15:55:15 +0200 Subject: [PATCH] Changed extraction of filename to MATLAB function "fileparts" --- load_bruker.m | 6 +++++- load_matlab.m | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/load_bruker.m b/load_bruker.m index f17c638..b9cfb69 100644 --- a/load_bruker.m +++ b/load_bruker.m @@ -51,7 +51,11 @@ params.mwPower = bruker_params.MWPW * 1e3; params.QValue = "NOT RECORDED"; params.mwAtten = str2double(extractBefore(string(bruker_params.PowerAtten),' ')); params.mwFreqs = "NOT RECORDED"; -params.Name = string(bruker_params.TITL); + +%get filename for further documentation and exporting figures +[datapath,dataname,~] = fileparts(corrpath); +params.Path = datapath; +params.Name = dataname; %echo what information is contained in the structure called 'params' params diff --git a/load_matlab.m b/load_matlab.m index 33a8347..2651886 100644 --- a/load_matlab.m +++ b/load_matlab.m @@ -28,12 +28,13 @@ function [Data,params] = load_matlab(path) % Name: "/some/path" %correct \ for / -corrpath = replace(path,"\","/") +corrpath = replace(path,"\","/"); load(corrpath,'Data','params') %get filename for further documentation and exporting figures -dataname = string(extractBefore(extractAfter(path,asManyOfPattern(wildcardPattern + "/")),'.')); +[datapath,dataname,~] = fileparts(corrpath); +params.Path = datapath; params.Name = dataname; %echo what information is contained in the structure called 'params'