How do I keep a deployed matlab executable from launching a new instance of the application each time I double click on it?
조회 수: 2 (최근 30일)
이전 댓글 표시
using Matlab, I created a deployable executable (let's call it ERNIE) that launches and works just fine. The only problem is, it launches a new instance of ERNIE every time I double click on the executable. I've written applications in C, C++, C# and VB and know how to code them so they do not launch a second instance. Can the same thing be done with my deployed Matlab application?
댓글 수: 0
답변 (1개)
Nagarjuna Manchineni
2017년 5월 15일
There is no inbuilt solution/flag to achieve the behavior. However, you can use the operating system specific ways to check whether the process is running or not before launching the application. For example, in windows, you can use the below code and create a .bat file that checks whether ERNIE is running or not and if it is not running then it launches the ERNIE application.
@ECHO OFF
SETLOCAL EnableExtensions
set EXE=ERNIE.exe
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND
REM echo Not running
start ERNIE.exe
goto FIN
:FOUND
echo Running
:FIN
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!