From 9d56441c79fad2103954c8ec5c3b7ab838d58f30 Mon Sep 17 00:00:00 2001 From: sakul-45 <81963567+sakul-45@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:10:07 +0200 Subject: [PATCH] Added correcting \ for / in input paths --- load_bruker.m | 5 ++++- load_matlab.m | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/load_bruker.m b/load_bruker.m index f2a5aef..2997cd3 100644 --- a/load_bruker.m +++ b/load_bruker.m @@ -11,8 +11,11 @@ function [Data,params] = load_bruker(path) % % Note that this funtion is dependent on easyspin. +%correct \ for / +corrpath = replace(path,"\","/"); + %load Bruker data with help of easyspin -[bruker_axes,Data,bruker_params] = eprload(path); +[bruker_axes,Data,bruker_params] = eprload(corrpath); %assign metadata to custom params struct params.Field_Center = bruker_params.YMIN + 0.5*bruker_params.YWID; diff --git a/load_matlab.m b/load_matlab.m index 8e03e32..03613e9 100644 --- a/load_matlab.m +++ b/load_matlab.m @@ -7,7 +7,10 @@ function [Data,params] = load_matlab(path) % string. The extracted name is appended to the 'params' struct, whos % contents are displayed in the command window afterwards. -load(path,'Data','params') +%correct \ for / +corrpath = replace(path,"\","/") + +load(corrpath,'Data','params') %get filename for further documentation and exporting figures dataname = string(extractBefore(extractAfter(path,asManyOfPattern(wildcardPattern + "/")),'.'));