diff --git a/matlab/gdat.m b/matlab/gdat.m
index 21e732d9549919e41112b0270f541d9586f6b661..3d462622cb382d57f9218c6fbdefef40c57d80e9 100644
--- a/matlab/gdat.m
+++ b/matlab/gdat.m
@@ -139,8 +139,7 @@ end
 % are many folders in the path
 subfunction = sprintf('gdat_%s',deblank(lower(machine_eff)));
 if isempty(which(subfunction)),
-  gdat_path = fileparts(mfilename('fullpath'));
-  addpath(fullfile(gdat_path,upper(machine_eff)));
+  gdatpaths; % to make create all subpaths
 end
 % NOTE: we could also check if it matches the path to the main function.