标题:大家给我帮帮忙关于C#和Matlab混编程的问题
取消只看楼主
terryzz5
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-11-8
结帖率:50%
已结贴  问题点数:13 回复次数:1 
大家给我帮帮忙关于C#和Matlab混编程的问题
Matlab的源码是function final_perf = netcalculator(perf, lev, m_fee, p_fee, rf)
% perf 是一个double数组
% lev是一个double
% m_fee是一个double
% p_fee是一个double
% rf是一个double

C#的源码是
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using MathWorks.
using MathWorks.
using netperfcal;   //


private void button3_Click(object sender, EventArgs e)
        {
            // declare vectors
               MWNumericArray Leverage = double.Parse(textBox2.Text);;
               MWNumericArray RiskFreeRate = double.Parse(textBox5.Text);
               MWNumericArray ManagementFee = double.Parse(textBox3.Text);
               MWNumericArray PerformanceFee = double.Parse(textBox4.Text);
               MWArray[] vector = null;
               MWArray[] argOut = null;

            if (dataGridView1.DataSource != null)
            {

                for (int i = 0; i < dataGridView1.RowCount - 1; i++)
                {
                    vector = double.Parse(dataGridView1.Rows.Cells[1].Value.ToString()); // 出错!vector的数据来自dataGridView1  
                }
            }

            netperfcalclass calculation = new netperfcalclass();
            argOut = ("vector", "db_Leverage", "db_ManagementFee", "db_PerformanceFee", "db_RiskFreeRate");    //出错!

            for (int j = 0; j < dataGridView1.RowCount - 1; j++)
            {
            // int row = dataGridView2.Rows.Add();
                dataGridView2.Rows[j].Cells[1].Value = argOut[j];
            }

请麻烦大家帮我看看吧!
搜索更多相关主题的帖子: Matlab 
2010-04-25 18:42
terryzz5
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-11-8
得分:0 
1。 可以给个例子吗?Vector应该怎么定义

2。 ()函数返回的是一个数组。


argOut = ("vector", "db_Leverage", "db_ManagementFee", "db_PerformanceFee", "db_RiskFreeRate");
改为
argOut = ((MWArray)vector, (MWNumericarray)Leverage, (MWNumericarray)ManagementFee, (MWNumericarray)PerformanceFee, (MWNumericarray)RiskFreeRate);

请在帮忙一下
2010-04-26 23:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-304384-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.046504 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved