Changed extraction of filename to MATLAB function "fileparts"

This commit is contained in:
sakul-45 2021-07-24 15:55:15 +02:00
parent 1210dbb16f
commit 43184cd02f
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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'