Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Using MATLAB with Apple's X11 beta Apps
MATLAB was ported to OS X as an X-windows application, and is currently only supported with the OroborOSX window manager. X11 is much faster, and it is easy make MATLAB operate with this manager.

First, make a backup copy of the LaunchMATLAB application in the bin/ subdirectory. Then inspect the package contents, and edit Contents -> launch_matlab.sh (TextEdit will do fine). Replace:
if [ "`ps xc | grep OroborOSX`" ]; then
# Bounce less if OroborOSX is already started
sleeptime=30
else
sleeptime=60
fi
# osascript -e 'tell application "OroborOSX" to activate'
osascript Contents/launch_oroborosx
... with ...
if [ "`ps xc | grep X11`" ]; then
sleeptime=20
else
sleeptime=30
fi
osascript Contents/launch_X11
The sleeptime has been reduced because X11 is so much faster :)

Finally, use the Applescript editor to make the run-only file 'launch_X11' (to be also put into Contents/), which simply activates X11. Now MATLAB launches and runs faster, and is more integrated with the rest of the system.

[Editor's note: I don't have MATLAB, so I wasn't able to test this one...]
    •    
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[22,702 views]  

Using MATLAB with Apple's X11 beta | 13 comments | Create New Account
Click here to return to the 'Using MATLAB with Apple's X11 beta' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A simpler and faster method
Authored by: MasterUltan on Jan 11, '03 12:31:13PM

Instead of "writing" another osascript to open X11, use the "open" command.
Comment out the line

osascript Contents/launch_oroborosx

and instead add the line:

open -a X11.

With this command you can also just delete/comment out the if/then statement which issues the sleep command.



[ Reply to This | # ]
A simpler and faster method
Authored by: agvaughan on Jan 12, '03 01:26:47AM

Note that there should be no period after X11 - ie,<br>
open -a X11<br>
works (mostly - I'm having trouble getting an application icon and whatnot).



[ Reply to This | # ]
re: A simpler and faster method
Authored by: only120xs on Jan 22, '03 08:53:05PM

Worked great, thanks!



[ Reply to This | # ]
Going a step further
Authored by: acdha on Jan 11, '03 06:18:04PM

I made a similar change ("open -a X11") and then realized that there's no reason not to repackage the entire MATLAB directory tree into that same LaunchMATLAB package which is less confusing for users:

Instructions



[ Reply to This | # ]
matlab under Apple's X11 beta - Going a step further
Authored by: TwilightZone on Jan 21, '03 10:47:43PM

Tried this suggestion but some detail must be missing.

/var/tmp/console.log reports

sh: Contents/launch_matlab.sh: /bin/sh: bad interpreter: Permission denied
Cannot execute launch_matlab.sh: No such file or directory



[ Reply to This | # ]
Re: matlab under Apple's X11 beta - Going a step further
Authored by: only120xs on Jan 22, '03 08:55:43PM

If someone can confirm whether those instructions work, or modify them so they do work, that would be cool; I don't really want to go through all that if it's not going to work...



[ Reply to This | # ]
matlab under Apple's X11 beta - Going a step further
Authored by: acdha on Jan 23, '03 03:35:41AM

Is it possible that you don't have the BSD subsystem installed? /bin/sh should be on every OS X box - it's about as generic as it gets.



[ Reply to This | # ]
Going a step further
Authored by: welch on Jan 22, '03 10:58:41PM

Wow, this worked for me. Matlab is still pig slow in starting for me (a license server access issue I'm sure) but this "step further" approach worked great for me. You have to follow his instructions carefully. In particular steps 1 and 3 for me. I didn't realy grock what he was saying in 3, despite it being very clear, but when I finally managed to follow his instructions---viola. Nice. Thanks.



[ Reply to This | # ]
Going a step further
Authored by: TwilightZone on Jan 22, '03 11:03:27PM

My apologies to all.....I tried it again and got it to work. This time I edited the original launch_matlab.sh instead of creating a new file and I didn't rename LaunchMATLAB. Not sure if either of these things had anything to do with the original failure!

Can I (should I) now remove OroborOSX? XDarwin?



[ Reply to This | # ]
Going a step further
Authored by: shiflett on Jan 22, '03 11:44:02PM

Very cool! Works like a charm to clean up the mess left by the Mathworks installation. With the sole exception of having to change the path to the help files (easily done from within Matlab itself), the limited tests I've done haven't found any problems. Thanks, acdha!



[ Reply to This | # ]
Going a step further
Authored by: welch on Jan 27, '03 09:02:28PM

Yes, I had to change the path to the help files too, makes sense. Menu File->Preferences, select "help". The path should then be something like

/Applications/MATLAB.app/Contents/MATLAB6p5/help

Awesome. Works very nicely.



[ Reply to This | # ]
Going a step further
Authored by: tierra on Apr 14, '03 01:40:17PM

I couldn't follow your instructions. I get lost on step 2. where
I'm supposed to look for the Contents directory. Where is it?
Which is the "Application Bundle Directory"?



[ Reply to This | # ]
Installing and Using MATLAB with Apple's X11 beta
Authored by: UltraNurd on Mar 04, '03 11:17:59PM

I intially posted this as a hint, but didn't get Rob's e-mail that I should just make it a comment...

The OS X installer that is included with the downloadable Jaguar patch for MATLAB R13, and the OS X installer that may be included on the MATLAB CDs, is designed to use OroborosX. I dumped OroborosX for Apple's much snappier X11, but the presence of /usr/X11R6/ was not enough to make the installer happy. Conveniently enough, the OS X installer is merely a wrapper AppleScript that sets a few variables and then passes them to the *nix install script. Right-click on the installer and select "Show package contents", open the Contents folder, and then open the file runme.txt in Script Editor. The stuff you'll want to comment out is all just error checking and install/setup for OroborosX. If you know you have Apple X11 installed properly, and currently have the X server open and running, comment out the following:

The entire block that begins with if xdarwinInstallerHere then
The entire block that begins with if oroborosInstallerHere then

This should prevent the installer from attempting to install OroborosX over your X11 install. Since you will probably be running the installer off of a read-only disk image or CD, you won't be able to save your changes. Instead just hit the Run button in Script Editor and follow the on-screen instructions. You'll be asked via OS X dialogs to select an install directory and a license file. Then the actual MATLAB installer will open inside of X11, and do its thing.

If you are installing off of the three CDs or disk images (mine was a networked disk image install), you may have to repeat the script editing step for the other two images/CDs. Also, make sure you do not have more than one of the images or CDs mounted at once; the method by which the AppleScript finds the install files gets screwed up when there are multiple volumes matching the expected name.

Finally, apply the Jaguar patch that you can download from MathWorks.

Depending on how you plan to use MATLAB, you will probably need to follow the instructions in this hint to automatically open X11.

I did this all using the 0.2 Apple X11 Beta and MATLAB R13. A few usage notes: I have found that I need to quit and reopen X11 before and after using MATLAB. I have not yet found the source of the problem, but if I do not do it beforehand, MATLAB opens and then crashes. Windows for MATLAB run in both X11 and a created-on-the-fly app called MATLAB (For example, SimuLink and plotted figures appear in X11, but the main interactions window stands alone.). To print from windows spawned in X11, select Print (ctrl-p) from the appropriate window's File menu, set your output to file, and save it as a PostScript file. Drag and drop that file onto a printer or printer queue inside of Print Center, and it will print. To print from windows inside of MATLAB (this includes figure windows drawn in X11), a dialog will come up in MATLAB setup to use your currently selected OS X printer.

[ Reply to This | # ]