default.aspx.cs

来自「开发环境: Matlab Version 7.8.0.347(R2009a) 」· CS 代码 · 共 54 行

CS
54
字号
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 + =
减小字号Ctrl + -
显示快捷键?