首頁>Club>
15
回覆列表
  • 1 # 使用者834195712159

    matlab程式如下:

    [plain] view plain copy

    function y=raicos(t)

    result=2t;

    end

    2.在C#中呼叫matlab的函式,使用上面的4個步驟,新增引用之後,C#程式如下

    [csharp] view plain copy

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using MathWorks.MATLAB.NET.Arrays;//系統dll檔案

    using Demodll;//自己生成的dll檔案

    namespace WebApplication1

    {

    public partial class WebForm26 : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    demo h = new demo();//demo為class名稱,h為定義的成員函式

    MWArray x;//定義x為矩陣變數,將普通數轉化為matlab能識別的型別

    x = demo.raicos((MWArray)i);//呼叫matlab裡的raicos函式

    }

    }

    }

  • 中秋節和大豐收的關聯?
  • 銀行卡錢突然減了怎麼辦?