From 41e1b3ae650ce644f3be82eaaa061dc7beae8246 Mon Sep 17 00:00:00 2001
From: Federico Felici <federico.felici@epfl.ch>
Date: Thu, 30 Sep 2021 13:31:24 +0200
Subject: [PATCH] Add setpaths_gdat.m for automatically adding paths

---
 matlab/gdatpaths.m     | 4 ++--
 matlab/setpaths_gdat.m | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
 create mode 100644 matlab/setpaths_gdat.m

diff --git a/matlab/gdatpaths.m b/matlab/gdatpaths.m
index 9d3cd1d9..3bbce8bc 100644
--- a/matlab/gdatpaths.m
+++ b/matlab/gdatpaths.m
@@ -11,7 +11,7 @@ end
 a=which('gdat');
 path_gdat = fileparts(a);
 if ~findstr(path,[path_gdat,':'])
-  warning('Folder %s containing gdat.m is not in your path!!',path_gdat);
+  error('Folder %s containing gdat.m is not in your path!!',path_gdat);
 end
 
 if isempty(a), error('gdat is not in the MATLAB path'); end
@@ -22,7 +22,7 @@ a = fileparts(a);
 machines=[{'JET'} {'TCV'} {'AUG'} {'D3D'} {'KSTAR'} {'TCV_IMAS'} {'AUG_IMAS'} {'CHDF'} {'IMAS'}];
 
 add_paths = cell(1,length(machines));
-for i=1:length(machines)
+for i=1:numel(machines)
   add_paths{i}=fullfile(a,machines{i});
 end
 if ~remove
diff --git a/matlab/setpaths_gdat.m b/matlab/setpaths_gdat.m
new file mode 100644
index 00000000..1b86417c
--- /dev/null
+++ b/matlab/setpaths_gdat.m
@@ -0,0 +1,2 @@
+% Call gdat path adding function
+gdatpaths();
-- 
GitLab