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

📄 vbex7_16.frm

📁 本人收集的一些有关matlab的代码程序设计 也不知道改选什么分类
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5595
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   5595
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Run MATLAB Function"
      Height          =   495
      Left            =   2040
      TabIndex        =   0
      Top             =   120
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   2055
      Left            =   480
      TabIndex        =   1
      Top             =   840
      Width           =   4815
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MatLab As Object
Dim Matlab1 As Object
Dim Result As String
Dim MReal(10, 10) As Double
Dim MImag() As Double
Dim MReal1(5, 5) As Double
Dim i, j, i0, j0 As Integer
Dim b0 As Double

Private Sub Command1_Click()
   MatLab.Execute ("a = hilb(11);")
   Call MatLab.GetFullMatrix("a", "base", MReal, MImag)
   b0 = 0
   For i = 0 To 10
      b0 = b0 + MReal(i, i)
   Next i
   Label1.Caption = b0
   i0 = 0: j0 = 0
   For i = 0 To 10 Step 2
      For j = 0 To 10 Step 2
         MReal1(i0, j0) = MReal(i, j)
         j0 = j0 + 1
      Next j
      i0 = i0 + 1: j0 = 0
   Next i
   Call MatLab.PutFullMatrix("BMat", "base", MReal1, MImag)
End Sub

Private Sub Form_Load()
   Set MatLab = CreateObject("Matlab.Application")
   Set Matlab1 = CreateObject("Matlab.Application")
End Sub

Private Sub Label1_Click()
   Matlab1.Execute ("[x,y] = meshgrid(-3:0.1:3,-2:0.1:2);")
   Matlab1.Execute ("z=(x.^2-2*x).*exp(-x.^2-y.^2-x.*y);")
   Matlab1.Execute ("surf(x,y,z); colorbar")
   Matlab1.Execute ("shading interp")
End Sub

⌨️ 快捷键说明

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