我很好奇是否可以将 matlab gui 添加到 powerpoint 演示文稿中。在演示文稿或打开 matlab 的链接中。
我调用这个函数,它会打开图形然后立即关闭它。
Private Sub click_Click()
Call RunFile("new_control_pan", "C:\Users\mhaartman\Documents\PANE_golden2\PANE_golden\code")
End Sub
Sub RunFile(FILENAME As String, Optional FilePath As String)
Dim MATLAB As Object
Dim Result As String
Dim Command As String
Dim MATLABWasNotRunning As Boolean
'''''''''''''''''''''''''''''''''''''''''''''''''''
' Set Up
'''''''''''''''''''''''''''''''''''''''''''''''''''
' Connect to the automation server.
' MATLAB becomes a MATLAB handle to the running instance
' of MATLAB.
On Error Resume Next ' Defer error trapping
MATLAB = GetObject(, "matlab.application")
If Err.Number <> 0 Then
MATLABWasNotRunning = True
Set MATLAB = CreateObject("matlab.application")
Err.Clear ' Clear Err object in case error occurred.
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''
' Do the Work
'''''''''''''''''''''''''''''''''''''''''''''''''''
If Not IsMissing(FilePath) And Not FilePath = "" Then
Command = "cd('" + FilePath + "')"
Result = MATLAB.Execute(Command)
End If
Command = FILENAME
Result = MATLAB.Execute(Command)
'Result = MsgBox("Done", vbOkayOnly, "Click when done")
End Sub
谢谢!