insert new must keep assigned dimensions ( row/col vector only) 93/18993/2
Antoine ELIAS [Fri, 27 Jan 2017 13:59:53 +0000 (14:59 +0100)]
Change-Id: Ica4b77982ef5a5d6c022d38c3823b27043610df0

scilab/modules/ast/src/cpp/types/arrayof.cpp

index ec9b6a5..4f5bada 100644 (file)
@@ -499,10 +499,24 @@ GenericType* ArrayOf<T>::insertNew(typed_list* _pArgs)
     if (getArgsDims(_pArgs, dims))
     {
         InternalType *pOut = NULL;
+
+        if (dims.size() == 1 && getDims() == 2)
+        {
+            if (getCols() != 1)
+            {
+                dims.insert(dims.begin(), 1);
+            }
+            else
+            {
+                dims.push_back(1);
+            }
+        }
+
         while (dims.size() < 2)
         {
             dims.push_back(1);
         }
+
         pOut = createEmpty((int)dims.size(), dims.data(), bComplex);
         ArrayOf* pArrayOut = pOut->getAs<ArrayOf>();
         pArrayOut->fillDefaultValues();