diff --git a/code/classes/SCDclass_expcode.m b/code/classes/SCDclass_expcode.m
index 4731ce30cba4b8cc94b1dc39e9a512c69d0734c2..f3e1474af4fce2c9155ac74585b92c77250cb562 100644
--- a/code/classes/SCDclass_expcode.m
+++ b/code/classes/SCDclass_expcode.m
@@ -710,7 +710,11 @@ classdef SCDclass_expcode
             for ii=1:numel(obj.exportedtps)
                 simstructnamedd=sprintf('%s_tmpl',char(obj.exportedtps(ii)));
                 simstructnamews=char(obj.exportedtps(ii));
-                simstruct=dd.getEntry(simstructnamedd).getValue;
+                try
+                  simstruct=dd.getEntry(simstructnamedd).getValue;
+                catch
+                  error('expcode:buildworkspacetpstruct',['tunable params structure ' simstructnamedd ' not found']);  
+                end
                 assignstr=sprintf('%s=temp;',simstructnamews);
                 assignin('base','temp',simstruct);
                 evalin('base',assignstr);