PowerPoint プレゼンテーションに matlab GUI を追加できるかどうか知りたいです。プレゼンテーション内または matlab を開くためのリンク内。
この関数を呼び出すと、Figure が開き、すぐに閉じます。
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
ありがとう!