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

1 visualización (últimos 30 días)

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Jun. de 2009
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.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2007b

Community Treasure Hunt

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

Start Hunting!

Translated by