//============================================================================= /// <summary> /// Read a named matrix of boolean from Scilab /// </summary> /// <param name="matrixName"> variable name</param> /// <returns>a matrix of boolean from scilab. If Variable name does not exist returns null</returns> public unsafe Boolean[] getNamedMatrixOfBoolean(string matrixName) { Boolean[] matrixBoolean = null; int[] iDim = getNamedVarDimension(matrixName); if (iDim != null) { int iRows = iDim[0]; int iCols = iDim[1]; int[] matrixInt = new int[iRows * iCols]; System.IntPtr ptrEmpty = new System.IntPtr(); // get values in matrixDouble Scilab_cs_wrapper.api_Err SciErr = Scilab_cs_wrapper.readNamedMatrixOfBoolean(ptrEmpty, matrixName, &iRows, &iCols, matrixInt); if (matrixInt != null) { matrixBoolean = new Boolean[iRows * iCols]; for (int i = 0; i < iRows * iCols; i++) { if (matrixInt[i] == 1) { matrixBoolean[i] = true; } else { matrixBoolean[i] = false; } } } } return(matrixBoolean); }