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

📄 magicdemoapp.vb

📁 matlab source code very useful to science study
💻 VB
字号:
' *******************************************************************************'' MagicDemoApp.vb'' This file is an example application for the MATLAB Builder for .NET product.'' Copyright 2001-2005 The MathWorks, Inc.'' *******************************************************************************Imports SystemImports System.ReflectionImports MathWorks.MATLAB.NET.UtilityImports MathWorks.MATLAB.NET.ArraysImports MagicDemoCompNamespace MathWorks.Demo.MagicSquareApp    ' <summary>    ' The MagicDemoApp class computes a magic square of the user specified size.      ' </summary>    ' <remarks>    ' args[0] - a positive integer representing the array size.    ' </remarks>    Class MagicDemoApp#Region " MAIN "        ' <summary>        ' The main entry point for the application.        ' </summary>        Shared Sub Main(ByVal args() As String)            Dim arraySize As MWNumericArray = Nothing            Dim magicSquare As MWNumericArray = Nothing            Try                ' Get user specified command line arguments or set default                If (0 <> args.Length) Then                    arraySize = New MWNumericArray(System.Int32.Parse(args(0)), False)                Else                    arraySize = New MWNumericArray(4, False)                End If                ' Create the magic square object                Dim magic As MagicSquare = New MagicSquare                ' Compute the magic square and print the result                magicSquare = magic.makesquare(arraySize)                Console.WriteLine("Magic square of order {0}{1}{2}{3}", arraySize, Chr(10), Chr(10), magicSquare)                ' Convert the magic square array to a two dimensional native double array                Dim nativeArray(,) As Double = CType(magicSquare.ToArray(MWArrayComponent.Real), Double(,))                Console.WriteLine("{0}Magic square as native array:{1}", Chr(10), Chr(10))                ' Display the array elements:                Dim index As Integer = arraySize.ToScalarInteger()                For i As Integer = 0 To index - 1                    For j As Integer = 0 To index - 1                        Console.WriteLine("Element({0},{1})= {2}", i, j, nativeArray(i, j))                    Next j                Next i                Console.ReadLine() 'Wait for user to exit application            Catch exception As Exception                Console.WriteLine("Error: {0}", exception)            End Try        End Sub#End Region    End ClassEnd Namespace

⌨️ 快捷键说明

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