亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? program.cs

?? interop between C# and matlab
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Collections.Generic;
using System.Text;

// MathWorks assemblies that ship with Builder for .NET
// and should be registered in Global Assembly Cache
using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.Arrays;

// Assembly built by Builder for .NET containing 
// math_on_numbers.m
using dotnet;

// To include the C Shared Library created with
// MATLAB Compiler we need to include InteropServices
// to integrate the unmanaged code
using System.Runtime.InteropServices;


// Copyright 2006, 2007 The MathWorks, Inc.

namespace example_ML_integration
{
    class Program
    {
        static void Main(string[] args)
        {
            //////////////////////
            // Runtime Parameters
            //////////////////////

            // Create a mode variable to determine which
            // method is used.
            // 1 = MATLAB Com engine interface
            // 2 = .NET Assembly
            // 3 = C shared library
            System.Int16 Mode = 3;

            ////////////////////
            // Input Parameters
            ////////////////////

            // create an array ar for the real part of "a"
            System.Array ar = new double[2];
            ar.SetValue(11, 0);
            ar.SetValue(12, 1);

            // create an array ai for the imaginary part of "a"
            System.Array ai = new double[2];
            ai.SetValue(1, 0);
            ai.SetValue(2, 1);

            // create an array br for the real part of "b"
            System.Array br = new double[2];
            br.SetValue(21, 0);
            br.SetValue(22, 1);

            // create an array bi for the imaginary part of "b"
            System.Array bi = new double[2];
            bi.SetValue(3, 0);
            bi.SetValue(4, 1);

            /////////////////////
            // Output Parameters
            /////////////////////

            // initialize variables for return value from ML
            System.Array cr = new double[2];
            System.Array ci = new double[2];
            System.Array dr = new double[2];
            System.Array di = new double[2];


            ////////////////////////
            // Call MATLAB function
            ////////////////////////
            // call appropriate function/method based on Mode
            if (Mode == 1)
            {
                // use MATLAB engine
                UseEngine(ar, ai, br, bi, ref cr, ref ci, ref dr, ref di);
            }
            else if (Mode == 2)
            {
                // use .NET assembly created with Builder for .NET
                UseDotNET(ar, ai, br, bi, ref cr, ref ci, ref dr, ref di);
            }
            else if (Mode == 3)
            {
                // use C Shared Library created with MATLAB Compiler
                UseClib(ar, ai, br, bi, ref cr, ref ci, ref dr, ref di);
            }
            // any other value of Mode is invalid and we can do nothing


            /////////////////////
            // Output to console
            /////////////////////
            DisplayMethod(Mode);
            DisplayArgs( true, ar, ai, br, bi); // true = input
            DisplayArgs(false, cr, ci, dr, di); // false = not-input or output
            DisplayEnd();


        }

        /*
         * All input and output arguments must have been allocated
         * prior to calling these functions
         * 
         *  Input: 
         *      ar  real      part of a
         *      ai  imaginary part of a
         *      br  real      part of b
         *      bi  imaginary part of b
         * 
         *  Output: 
         *      cr  real      part of c
         *      ci  imaginary part of c
         *      dr  real      part of d
         *      di  imaginary part of d
        */
        static private void UseEngine(Array ar, Array ai, Array br,
            Array bi, ref Array cr, ref Array ci, ref Array dr, ref Array di)
        {
           /*
            * This function calls the math_by_numbers routine inside
            * MATLAB using the MATLAB Engine's com interface
            */
        
            // Instantiate MATLAB Engine Interface through com
            MLApp.MLAppClass matlab = new MLApp.MLAppClass();

            // Using Engine Interface, put the matrix "a" into 
            // the base workspace.
            // "a" is a complex variable with a real part of ar,
            // and an imaginary part of ai
            matlab.PutFullMatrix("a", "base", ar, ai);

            // Using Engine Interface, put the matrix "b" into 
            // the base workspace.
            // "b" is a complex variable with a real part of br,
            // and an imaginary part of bi
            matlab.PutFullMatrix("b", "base", br, bi);

            // Using Engine Interface, execute the ML command
            // contained in quotes.
            matlab.Execute("cd c:\\demos\\CSharp_MATLAB\\mcode;");
            matlab.Execute("open math_on_numbers.m");
            matlab.Execute("dbstop in math_on_numbers.m");
            matlab.Execute("[c, d] = math_on_numbers(a,b);");
            matlab.Execute("com.mathworks.mlservices.MLEditorServices.closeAll");
            //matlab.Execute("dbquit all");

            // Using Engine Interface, get the matrix "c" from
            // the base workspace.
            // "c" is a complex variable with a real part of cr,
            // and an imaginary part of ci
            matlab.GetFullMatrix("c", "base", ref cr, ref ci);

            // using engine interface, get the matrix "c" from
            // the base workspace.
            // "d" is a complex variable with a real part of dr,
            // and an imaginary part of di
            matlab.GetFullMatrix("d", "base", ref dr, ref di);

        }

        static private void UseDotNET(Array ar, Array ai, Array br,
            Array bi, ref Array cr, ref Array ci, ref Array dr, ref Array di)
        {
            /*
             * This function calls the math_by_numbers method from
             * inside a .NET assembly created with MATLAB using Builder
             * for .NET.
             */

            // Instantiate our .NET class from the MATLAB created component
            dotnetclass AClass = new dotnetclass();

            // explicity convert our input arguments into MWArrays
            // this can be done with implicit conversion
            MWNumericArray a = new MWNumericArray(1, 2, (double[])ar, (double[])ai);
            MWNumericArray b = new MWNumericArray(1, 2, (double[])br, (double[])bi);

            // call math_on_method from Assembly specifying the number
            // of return arguments expected and passing in a and b
            MWArray[] RetVal = AClass.math_on_numbers(2, a, b);

            // Unpack return values seperating the real and imaginary parts
            // using the ToArray method of MWNummericArray.  Since RetVal was
            // declared as a MWArray above, it must be explicity typecast here.  
            cr = ((MWNumericArray) RetVal[0]).ToVector(MWArrayComponent.Real);
            ci = ((MWNumericArray) RetVal[0]).ToVector(MWArrayComponent.Imaginary);
        
            dr = ((MWNumericArray) RetVal[1]).ToVector(MWArrayComponent.Real);
            di = ((MWNumericArray) RetVal[1]).ToVector(MWArrayComponent.Imaginary);

        }

        static private void UseClib(Array ar, Array ai, Array br,
            Array bi, ref Array cr, ref Array ci, ref Array dr, ref Array di)
        {
            /*
             * This function calls the math_by_numbers method from
             * inside a C Shared Library created with MATLAB Compiler.
             */

            // A new class Clib is used to wrap the unmanaged library.
            // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcreatingprototypesinmanagedcode.asp
            
            // The new class is instantiated here.
            Clib AClass = new Clib();

            AClass.DoTheWork(ar, ai, br, bi, ref cr, ref ci, ref dr, ref di);

        }

        class Clib

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美影片第一页| 中文字幕亚洲精品在线观看| 久久久久久影视| 亚洲影视资源网| 国产精品一卡二卡| 欧美日韩亚洲国产综合| 国产亚洲婷婷免费| 天使萌一区二区三区免费观看| 国产v日产∨综合v精品视频| 欧美图片一区二区三区| 久久综合久久综合久久| 亚洲一区二区在线播放相泽| 成人做爰69片免费看网站| 欧美成人一区二区| 亚洲成人一区在线| 在线观看欧美精品| 亚洲欧美日韩国产综合在线| 国产成人av影院| 精品久久五月天| 蜜桃传媒麻豆第一区在线观看| 日本丶国产丶欧美色综合| 国产日韩成人精品| 国产一区二区视频在线播放| 51久久夜色精品国产麻豆| 夜夜操天天操亚洲| 91丨九色丨蝌蚪丨老版| 亚洲国产精品99久久久久久久久| 久久精品国产久精国产| 91精品国产综合久久久久久| 亚洲国产视频a| 欧美在线视频日韩| 亚洲影视在线播放| 欧美天堂一区二区三区| 一区二区三区四区在线播放 | 日韩国产在线一| 色婷婷综合中文久久一本| 中文字幕一区在线| 97久久精品人人澡人人爽| 国产人妖乱国产精品人妖| 懂色av中文字幕一区二区三区| 国产亚洲一区二区在线观看| 国产99久久久精品| 欧美激情一区二区| 99久久久久久99| 亚洲精品写真福利| 欧美日韩一区二区电影| 日本免费新一区视频 | 日本乱人伦一区| 亚洲综合色噜噜狠狠| 欧美亚洲禁片免费| 日日摸夜夜添夜夜添亚洲女人| 在线不卡中文字幕| 极品销魂美女一区二区三区| 欧美成人三级在线| 成人精品电影在线观看| 亚洲精品乱码久久久久久黑人| 一本大道久久a久久综合| 亚洲福利视频导航| 久久久综合精品| av不卡在线观看| 丝袜国产日韩另类美女| 日韩欧美一级在线播放| 成人美女在线观看| 五月婷婷综合网| 欧美精品一区二区蜜臀亚洲| 99久久综合99久久综合网站| 午夜视黄欧洲亚洲| 国产午夜精品久久| 欧美日韩国产首页在线观看| 久久综合综合久久综合| 国产精品成人免费精品自在线观看| 在线观看一区二区精品视频| 免费成人在线视频观看| 国产精品电影一区二区| 欧美一卡二卡三卡四卡| 91啪九色porn原创视频在线观看| 亚洲影院在线观看| 中国av一区二区三区| 欧美日韩国产精品自在自线| 国产成人综合网站| 视频一区中文字幕| 亚洲欧美国产毛片在线| 国产日韩在线不卡| 91精品国产综合久久精品 | 久久久久久久久久久电影| 色婷婷精品久久二区二区蜜臂av| 久久99久久精品| 一区二区激情小说| 中文字幕在线视频一区| 欧美xxxx在线观看| 欧美午夜精品免费| 国产69精品一区二区亚洲孕妇| 亚洲成a人v欧美综合天堂下载 | 国产麻豆精品theporn| 亚洲男人天堂一区| 国产亚洲欧美一级| 日韩欧美国产综合在线一区二区三区| 色哟哟亚洲精品| 丁香婷婷综合五月| 国产一区在线观看视频| 麻豆freexxxx性91精品| 亚洲韩国一区二区三区| 亚洲精品国产精品乱码不99 | 欧美tickling网站挠脚心| 在线观看av一区| 色偷偷久久人人79超碰人人澡| 国产精品一二三| 国产一区二区在线看| 久久成人免费日本黄色| 日本美女视频一区二区| 婷婷一区二区三区| 午夜一区二区三区视频| 一区二区免费视频| 亚洲韩国精品一区| 偷拍一区二区三区四区| 一区二区免费视频| 亚洲香肠在线观看| 午夜久久久影院| 琪琪一区二区三区| 美女在线视频一区| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美精品一区二区三区蜜臀| 欧美电影免费观看高清完整版在 | 欧美一区二区精美| 欧美一二三四在线| 日韩视频免费观看高清完整版在线观看 | 中文字幕一区二区5566日韩| 日本一区二区三区在线观看| 久久人人爽人人爽| 国产精品青草综合久久久久99| 国产清纯白嫩初高生在线观看91| 久久精品一二三| 国产精品国产精品国产专区不蜜| 亚洲天堂网中文字| 亚洲一级片在线观看| 亚洲一区二区三区视频在线播放| 亚洲第一av色| 国产一区二区三区不卡在线观看| 国产乱妇无码大片在线观看| 成人一区二区三区在线观看| 91啪亚洲精品| 91精品国产综合久久久久| 久久亚洲综合色一区二区三区| 国产精品午夜久久| 亚洲成人三级小说| 国产精品羞羞答答xxdd| 99精品热视频| 欧美二区三区的天堂| 国产视频视频一区| 亚洲国产精品人人做人人爽| 激情综合亚洲精品| 91啪九色porn原创视频在线观看| 欧美日韩色综合| 久久精品一区蜜桃臀影院| 亚洲精品成人在线| 精品在线一区二区| 色av综合在线| wwwwww.欧美系列| 亚洲激情图片一区| 国产一区二区三区在线观看免费| av一区二区三区黑人| 这里只有精品99re| 国产精品萝li| 精久久久久久久久久久| 在线视频欧美精品| 久久久久国产精品人| 亚洲国产一区二区视频| 国产iv一区二区三区| 91麻豆精品国产91久久久久久久久| 久久久久国产免费免费| 日本一不卡视频| 色菇凉天天综合网| 国产欧美日韩在线| 久久精品国产亚洲5555| 色老汉av一区二区三区| 久久久.com| 热久久免费视频| 欧洲生活片亚洲生活在线观看| 久久综合色天天久久综合图片| 亚洲尤物在线视频观看| 99麻豆久久久国产精品免费| 精品成人佐山爱一区二区| 亚洲高清一区二区三区| 91亚洲精品乱码久久久久久蜜桃| 欧美成人一级视频| 日韩av高清在线观看| 欧美视频一区二区三区四区 | jlzzjlzz亚洲日本少妇| 久久久精品国产99久久精品芒果 | 国产精品99久久久久久有的能看| 欧美一区二区精品久久911| 亚洲图片欧美一区| 欧美视频完全免费看| 亚洲精品大片www| 91视频一区二区三区| ...中文天堂在线一区| 国产成人亚洲综合a∨猫咪| 精品美女在线播放| 久久er精品视频| 日韩欧美一区二区久久婷婷|