集册 Java实例教程 绑定两个线性数组,生成一个二维数组。

绑定两个线性数组,生成一个二维数组。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

681
绑定两个线性阵列,生成2D阵列。

/*
时代Java公众号 - N o w J a  v a . c o m 提 供
*/


public class Main{


    /**

     * Binds two linear arrays, producing a 2D array.

     * 

     * @param axis The first component array.

     * @param seriesData The second component array.

     * @return Binded rows.

     * @throws DTWException If error occures.

     */

    public static double[][] rBind(double[] axis, double[] seriesData)

            throws DTWException {

        if (axis.length == seriesData.length) {

            int len = axis.length;

            double[][] res = new double[len][2];

            for (int i = 0; i < len; i++) {

                res[i][0] = axis[i];

                res[i][1] = seriesData[i];

            }/* 来自 n o w j a v a . c o m - 时  代  Java*/

            
展开阅读全文