zoukankan      html  css  js  c++  java
  • 矩阵,datatable,double[]

    image

    double[] a = new double[10] { 55, 65, 80, 90, 95, 105, 125, 135, 140, 150 };
    double[,] b = new double[3, 10]{
    {1,2,3,4,5,6,7,8,9,10},
    {20,21,25,27,28,31,38,40,41,42},
    {1.5,2,2.8,2.9,3.4,3.6,3.8,3.9,4,4.5}
    };
    dynamic re = xl.WorksheetFunction.LinEst(a, b, con, stat);
    return JsonConvert.SerializeObject(re);

    //将DataTable转为二维数组
    private double[,] DataTableToArray(DataTable dt) {
    int i = 0;
    int rowsCount = dt.Rows.Count;
    int colsCount = dt.Columns.Count;
    double[,] arrReturn = new double[rowsCount, colsCount];
    foreach (System.Data.DataRow row in dt.Rows) {
    int j = 0;
    foreach (System.Data.DataColumn column in dt.Columns) {
    arrReturn[i, j] = Convert.ToDouble(row[column.ColumnName]);
    j = j + 1;
    }
    i = i + 1;
    }
    return arrReturn;
    }

    忍者软件 www.renzhe.org
  • 相关阅读:
    c#调用DLL
    蚁群算法
    ManualResetEvent类的使用
    AsyncResult 类的使用
    同步调用与异步调用
    MFC套接字编程
    windows套接字编程
    socket的IO模型
    socket编程基础知识
    Hog行人检测
  • 原文地址:https://www.cnblogs.com/renzhe-org/p/15542466.html
Copyright © 2011-2022 走看看