How can I create a dock icon that runs a specific MATLAB script on my Mac running MATLAB 7.5 (R2007b)?

조회 수: 1 (최근 30일)
I want to create a dock icon that runs a specific MATLAB script on my Mac running MATLAB 7.5 (R2007b).

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
You will need to create a copy of your MATLAB launch script and include the '-r' option followed by the script name that you want to run. In order to do this, follow the steps below:
1. Go to $MATLAB/bin/$arch and create a copy of the application 'StartupMATLAB' to, say, 'StartupMATLAB_copy'. In the above path, '$MATLAB' is your MATLAB installation directory, and '$arch' is 'maci'.
The application 'StartupMATLAB' is actually a directory structure so you may need to change your browser mode to inspect the contents of this structure for the steps that follow.
2. Go to the directory 'StartupMATLAB_copy/Contents' and edit the file 'launch_matlab.sh'. There are two lines to modify, both starting with the '$SHELL' directive. If, for example, the MATLAB script you want to run is called 'myscript.m', the modified lines look like follows:
if [ "$DISPLAY" = "" ]; then
echo ""
echo "Warning [$0]: We could not determine display. Default to :0.0."
echo ""
$SHELL -c 'bin/'$ARCH'/setsid bin/matlab -desktop -display :0.0 -r myscript &'
else
$SHELL -c 'bin/'$ARCH'/setsid bin/matlab -desktop -r myscript &'
fi
3. After modifying the launch script, go to the application browser and drag the StartupMATLAB_copy icon to the Mac dock.
Recall that if you want to terminate MATLAB after your script is run, you will need to insert an EXIT statement at the end of your script.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2007b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by