diff --git a/+PlotID/createFileCopy.m b/+PlotID/createFileCopy.m
index 297203c57e65a916d5e4b359b93616edbbf3b5ec..544c43388fef70a4320cd7c2fa384df12eba9e8b 100644
--- a/+PlotID/createFileCopy.m
+++ b/+PlotID/createFileCopy.m
@@ -29,6 +29,8 @@ end
             case 'script'
                 sufix = '_script';
                 newfile = sprintf([ID, sufix ,ext]);
+                %script filename in matlab cannot include '-'
+                newfile = regexprep(newfile,'-','_'); 
             case 'userFcn'
                 %keep original name
                 newfile = sprintf([name,ext]);