// Split MWCellArray into two MWCellArrays
  private MWCellArray vect_FaultsSplit(MWCellArray vect_Faults, int index) {
    //        vect_Faults
    try {
      int[] cellsSizeArray = {1};
      MWCellArray vect_Faults1 = new MWCellArray(cellsSizeArray);
      double[] vectorArray = ((double[][]) ((Object[]) vect_Faults.toArray()[0])[0])[0];
      int arraySize = vectorArray.length / 2;
      double[] vectorArrayNew = new double[arraySize];

      switch (index) {
        case 0:
          for (int i = 0; i < arraySize; i++) {
            vectorArrayNew[i] = vectorArray[i];
          }
          break;
        case 1:
          int arrayIndex = 0;
          for (int i = arraySize; i < vectorArray.length; i++) {
            vectorArrayNew[arrayIndex] = vectorArray[i];
            arrayIndex++;
          }
          break;
      }
      vect_Faults1.set(1, vectorArrayNew);
      return vect_Faults1;
    } catch (Exception e) {
      // LOG.error(e.getMessage());
      System.out.println(e.getMessage());
      return null;
    }
  }
  private MWCellArray getVect_FaultSplit(MWCellArray v_Faults, int position) {
    int[] arraySize = {1};
    MWCellArray vect_Faults = new MWCellArray(arraySize);

    double[] i = {22.0, 23.0, 24.0, 25.0};
    vect_Faults.set(1, i);

    return vect_Faults;
  }
  // This function processes distribution setup wrapper matlab function
  public void getMatlabData(MWStructArray zones, MWStructArray faults) {
    try {

      LOG.error("Processing Distribution_Setup");

      Distribution_SetupWrapper distributionsetup = new Distribution_SetupWrapper();
      Object[] distributionsetupobj = null;
      distributionsetupobj = distributionsetup.Distribution_Setup(7, zones, faults);

      MWCellArray vect_gridPoints = null;
      MWCellArray maxNumOfEventPerPartition = null;
      MWNumericArray numlabs_gridPoints = null;
      MWNumericArray labindex_gridPoints = null;
      MWCellArray vect_Faults = null;
      MWNumericArray numlabs_Faults = null;
      MWNumericArray labindex_Faults = null;

      vect_gridPoints = (MWCellArray) distributionsetupobj[0]; // Vector Grid points
      maxNumOfEventPerPartition = (MWCellArray) distributionsetupobj[1]; //
      numlabs_gridPoints = (MWNumericArray) distributionsetupobj[2]; //
      labindex_gridPoints = (MWNumericArray) distributionsetupobj[3]; //
      vect_Faults = (MWCellArray) distributionsetupobj[4]; //
      numlabs_Faults = (MWNumericArray) distributionsetupobj[5]; //
      labindex_Faults = (MWNumericArray) distributionsetupobj[6]; //

      // Serialize all matlab object
      maxNumOfEventList = getByteArraylist(maxNumOfEventPerPartition.serialize());
      vect_gridPointsList1 = getByteArraylist(vect_gridPointsSplit(vect_gridPoints, 0).serialize());
      vect_FaultsList1 = getByteArraylist(vect_FaultsSplit(vect_Faults, 0).serialize());
      vect_gridPointsList2 = getByteArraylist(vect_gridPointsSplit(vect_gridPoints, 1).serialize());
      vect_FaultsList2 = getByteArraylist(vect_FaultsSplit(vect_Faults, 1).serialize());

      // For testing only
      vect_gridPointsListAll = getByteArraylist(vect_gridPoints.serialize());
      vect_FaultsListAll = getByteArraylist(vect_Faults.serialize());

    } catch (Exception e) {
      LOG.error(e.getMessage());
      System.out.println(e.getMessage());
    }
  }