⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.cs

📁 开发环境: Matlab Version 7.8.0.347(R2009a) Visual Studio 2005(.NET 2.0, C#) 演示如何在ASP.NET(C#)网页中调用MATL
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.Arrays;

using PlotComp;

[assembly: NativeGC(true, GCBlockSize = 25)]  // Set native memory management block size to 25 MB.

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

        try
        {
            const int numPoints = 10;  // Number of points to plot

            // Allocate native array for plot values
            double[,] plotValues = new double[2, numPoints];

            // Plot 5x vs x^2
            for (int x = 1; x <= numPoints; x++)
            {
                plotValues[0, x - 1] = x * 5;
                plotValues[1, x - 1] = x * x;
            }

            // Create a new plotter object
            Plotter plotter = new Plotter();

            // Plot the two sets of values - Note the ability to cast the native array to a MATLAB numeric array
            plotter.drawgraph((MWNumericArray)plotValues);

            //Console.ReadLine();  // Wait for user to exit application
        }

        catch (Exception exception)
        {
            //Console.WriteLine("Error: {0}", exception);
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -