From a7595b139bc6cdb94896e88c3a2dca4f71410063 Mon Sep 17 00:00:00 2001
From: Federico Felici <federico.felici@epfl.ch>
Date: Fri, 26 Jul 2019 16:16:15 +0200
Subject: [PATCH] Return to base workspace only if nargout==0

---
 code/functions/SCDconf_createexpcodes.m | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/code/functions/SCDconf_createexpcodes.m b/code/functions/SCDconf_createexpcodes.m
index 6f78bed..a7bf2d3 100644
--- a/code/functions/SCDconf_createexpcodes.m
+++ b/code/functions/SCDconf_createexpcodes.m
@@ -1,4 +1,4 @@
-function [] = SCDconf_createexpcodes()
+function SCDexps = SCDconf_createexpcodes()
 
 %% The expcode container,
 % it contains a list of expcode numbers and function pointers
@@ -15,8 +15,10 @@ SCDexps=SCDexps.insertexpcode(1005, @(x) SCDexpcodeconf_tcvstandard02);
 SCDexps=SCDexps.insertexpcode(10  , @(x) SCDexpcodeconf_f4eexample);
 SCDexps=SCDexps.insertexpcode(1006, @(x) SCDexpcodeconf_DMmagcontrol);
 
-
-assignin('base','SCDexps',SCDexps);
+if nargout == 0
+  % assign output argument in base
+  assignin('base','SCDexps',SCDexps);
+end
 
 end
 
-- 
GitLab