예제 #1
0
 //=============================================================================
 /// <summary>
 /// Write a named matrix of boolean in Scilab
 /// </summary>
 /// <param name="matrixName"> variable name</param>
 /// <param name="iRows"> Number of row</param>
 /// <param name="iCols"> Number of column</param>
 /// <param name="matrixBoolean"> pointer on data</param>
 /// <returns> if the operation successes (0) or not ( !0 )</returns>
 public int createNamedMatrixOfBoolean(string matrixName, int iRows, int iCols, Boolean[] matrixBoolean)
 {
     int[] matrixInt = new int[matrixBoolean.Length];
     for (int i = 0; i < matrixBoolean.Length; i++)
     {
         if (matrixBoolean[i] == true)
         {
             matrixInt[i] = 1;
         }
         else
         {
             matrixInt[i] = 0;
         }
     }
     System.IntPtr             ptrEmpty = new System.IntPtr();
     Scilab_cs_wrapper.api_Err SciErr   = Scilab_cs_wrapper.createNamedMatrixOfBoolean(ptrEmpty, matrixName, iRows, iCols, matrixInt);
     return(SciErr.iErr);
 }