// 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; }