Пример #1
0
  /**
   * getting values as {@link Double} from given as {@link MLArray} matlab matrix
   *
   * @return List<Double>
   */
  private static List<Double> getValuesAsList(final MLArray pMLArray) throws Exception {
    final List<Double> lListRes = new ArrayList<>();
    if (pMLArray == null) {
      throw new Exception(
          "Incorrect SWAN output as matlab array class(Level4): data information has incorrect precision "); //$NON-NLS-1$
    }

    final MLNumericArray lMLArray = (MLNumericArray) pMLArray;

    for (int m = 0; m < lMLArray.getM(); m++) {
      for (int n = 0; n < lMLArray.getN(); n++) {
        lListRes.add((lMLArray.get(m, n)).doubleValue());
      }
    }
    return lListRes;
  }