diff --git a/matlab/gdatpaths.m b/matlab/gdatpaths.m
index 9d3cd1d92410ac56fc56f6f9efc82bfa35221fb0..3bbce8bc87360206db2959c799f469eb8839b42f 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 0000000000000000000000000000000000000000..1b86417ca7f52101e8186ef2b03812c9d6bb2d07
--- /dev/null
+++ b/matlab/setpaths_gdat.m
@@ -0,0 +1,2 @@
+% Call gdat path adding function
+gdatpaths();