Tuesday, 31 January 2012

Matlab draw plot graph closed automatically

Matlab 7.4
Mac 10.6

Problem:
When I use Matlab to draw graphs, like hist(x,y), scatter(x,x), the matlab will close automatically

Solution:
http://www.mathworks.com/matlabcentral/answers/11086-matlab-closing-automatically-when-plotting-data-or-opening-an-existing-saved-figure


There is an incompatibility in a recent Java update (1.6.0_26) affecting MATLAB versions R2007a, R2007b and R2008a, that can be worked around by following these steps:
1. Close MATLAB, if it is running.
2. In Terminal or xterm , type:
open -a TextEdit /Applications/MATLAB_R2008a/bin/.matlab7rc.sh
In the path above, change "/Applications/MATLAB_R2008a/bin/" accordingly depending on your version of MATLAB's root folder name.
3. In the editor, navigate to Line 410 to locate:
DYLD_LIBRARY_PATH=
This line is a part of the following code in the "mac" section of matlab7rc.sh:
if [ "$DYLD_LIBRARY_PATH" != "" ]; then
   DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
else
   DYLD_LIBRARY_PATH=
fi
4. Change the line from
DYLD_LIBRARY_PATH
to
DYLD_LIBRARY_PATH=/System/Library/Frameworks/JavaVM.framework/Libraries
For users on MATLAB R2007a and R2007b, after making the change in the "mac" section, make the same change the "maci" section (right below the "mac" section).
5. Save the changes (Command-S).
6. Restart MATLAB.

No comments:

Post a Comment