mtlbree2sci function updated due to operations with empty matrix. 20/18120/2
Adeline CARNIS [Mon, 25 Apr 2016 15:46:50 +0000 (17:46 +0200)]
test_run('compatibility_functions', 'bug_4603')

Change-Id: I851d57fd0fac8f305a5e104c431f2b56e5b689d8

scilab/modules/m2sci/macros/kernel/mtlbtree2sci.sci

index 7dcfb26..0f82234 100644 (file)
@@ -58,12 +58,20 @@ function [scitree,crp]=mtlbtree2sci(mtlbtree,prettyprintoutput)
         for k=1:size(scitree.outputs)
             lhsstr=[lhsstr,expression2code(scitree.outputs(k))]
         end
-        lhsstr="["+strcat(lhsstr,",")+"]"
+        if ~isempty(lhsstr) then
+            lhsstr="["+strcat(lhsstr,",")+"]"
+        else
+            lhsstr = "[]";
+        end
 
         for k=1:size(scitree.inputs)
             rhsstr=[rhsstr,expression2code(scitree.inputs(k))]
         end
-        rhsstr="("+strcat(rhsstr,",")+")"
+        if ~isempty(rhsstr) then
+            rhsstr="("+strcat(rhsstr,",")+")"
+        else
+            rhsstr = "()";
+        end
 
         crp=lhsstr+" = "+scitree.name+rhsstr;
     end