C# 调用 Matlab dll

引入引用

在这里插入图片描述

实例化

namespace WindowsFormsApp1
{
    
    
    public partial class Form1 : Form
    {
    
    
        public Form1()
        {
    
    
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
    
    
            textBox1.Text = "";
            ceshiNative.ceshi dsd = new ceshiNative.ceshi();
            var obj = dsd.ceshi1(1);
            double[,] arr = obj[0] as double[,];
            for (int i = 0; i < arr.Length; i++)
            {
    
    
                textBox1.Text += arr[0, i].ToString() + "\r\n";
            }

        }
    }
}

效果

在这里插入图片描述

备注

低版本的Matlab对 Win10 .net4.0以上版本支持不好,建议使用低版本.net RCT。

猜你喜欢

转载自blog.csdn.net/bayinglong/article/details/127756680