Once again, I’d like to welcome guest blogger Ken Atwell. Ken is a product manager for MATLAB who spends much of his time focusing on platform support. His past blog posts about the release of Snow Leopard and Windows 7 generated quite a bit of interest and discussion, so Ken will be occasionally blogging about platform considerations when using MATLAB. This week, Ken writes about the relationship between MATLAB and the Mac OS X Dock.
The Dock is OS X’s mechanism for giving users access to frequently-used applications. There are two primary ways to get an application into the Dock. However, in the case of MATLAB, only one of these will work:
- The Working Way. Go to your Applications folder and drag the MATLAB application (it will be called “MATLAB_R2009b.app” or similar, depending on the version of MATLAB you have installed) to the Dock (Figure 1). The icon will be the familiar L-shaped membrane, but with an up-arrow overlay.
- The Not Working Way. Start MATLAB from Applications, and then add MATLAB to the Dock using click-and-hold->Options->Keep in the Dock. Unfortunately, starting MATLAB from a Dock icon created this way will results in a MATLAB crash at start-up. If you have created a Dock icon in this manner, remove it and recreate it using the “working” method above.
What is going on?! The reason for this behavior lies in MATLAB’s somewhat complex start-up sequence. MATLAB is started through a starter application that is responsible for starting the “real” MATLAB. In the first case, the starter application is added to the Dock (which is why the icon includes an up-arrow). In the second case, the “real” MATLAB is added to the Dock, and starting the “real” MATLAB directly from the Dock (or the Finder, for that matter) results in a crash. We expect to correct this in a future version of MATLAB.
With the starter application in the Dock, MATLAB should start normally and you will get a second MATLAB icon (the running, “real” MATLAB) in the Dock (Figure 2). Again, we acknowledge this is could be improved; there should only be one icon.
Once MATLAB is running, you can use either of these icons to bring MATLAB into focus. Given this behavior, it may be unclear how you can start a second instance of MATLAB. You can do this from a Terminal window as follows (replacing “R2009b” with your version of MATLAB as required):
- Go to the Utilities folder inside your Application folder.
- Open Terminal.
- Type: /Applications/MATLAB_R2009b.app/bin/matlab
- Press Return.
Note that closing the terminal window will also close the second MATLAB.
Be aware that changing any application setting that is saved on disk, such as your Preferences, Desktop layout, and MATLAB path, will not take effect across other already-running instances of MATLAB, and the exact state that will be stored to disk can be difficult to predict. For this reason, I recommend against wholesale changes to your MATLAB environment when running multiple instances of MATLAB.
I hope this information will be helpful to Mac users who would like to launch MATLAB directly from the Dock. If you have any other Dock tricks you’d like to share with fellow MATLAB users, please chime in below!
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.