버튼을 클릭하면 프로세스 (MATLAB)가 실행되고 파일이 실행되는 Windows 양식이 있습니다.vb.net에서 이미 열려있는 프로세스를 실행하십시오.
Dim myProcesses() As Process
myProcesses = Process.GetProcessesByName("Matlab")
If myProcesses.Count > 0 Then
'~~~~ what goes here? ~~~~
Else
Dim startInfo As New ProcessStartInfo
startInfo.FileName = "C:\Program Files\MATLAB\R2011b\bin\matlab.exe"
startInfo.WorkingDirectory = MatlabDir 'MatlabDir is defined elsewhere
startInfo.Arguments = "matlab.exe -r test_plot2"
Process.Start(startInfo)
End If
위의 코드는 MATLAB이 열렸으며 MATLAB이 아직 열려 있지 않으면 "test_plot2.m"스크립트를 실행합니다. 하지만 MATLAB이 이미 열려 있고 파일을 실행하기를 원한다면 첫 번째 IF 문에서 무엇을 작성해야합니까?
미리 감사드립니다.
아마도 MATLAB에 명령 기반 사용자 인터페이스가 있습니다. 즉 "test_plot2.m"을 실행하려는 경우 명령 창에 "test_plot2"를 입력하면됩니다. – raheel88