Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts

Jun 21, 2010

ERROR: Matlab `GCC_4.2.0' not found

A matlab error: /usr/local/matlab7/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)

Solution:

$ cd /usr/local/matlab/sys/os/glnx86 OR /YOUR_PATH_TO_MATLAB/sys/os/glnx86
$ mv libgcc_s.so.1 libgcc_s.so.1_back
$ ln -s /lib/libgcc_s.so.1 libgcc_s.so.1

Sep 23, 2009

Oops! Matlab gives OpenGL Error !!!

In matlab, do you get error when you prompt:
[MATLAB] >> opengl info
If yes, you have to link your opengl libraries. Firstly, look at your libraries :
[TERMINAL] >> cd /usr/lib
[TERMINAL] >> ls *GL*

you have some libGL, libGLU libraries. Here is my results:
libEGL.so libGL.so libQtOpenGL.prl
libGLcore.so.1 libGL.so.1 libQtOpenGL.so
libGLcore.so.177.82 libGL.so.177.82 libQtOpenGL.so.4
libGLESv2.so libGLU.a libQtOpenGL.so.4.4
libGLEW.so.1.5 libGLU.so libQtOpenGL.so.4.4.3
libGLEW.so.1.5.0 libGLU.so.1
libGL.la libGLU.so.1.3.070200

You can get the correct version of these libraries by setting up MATLAB to use your native Linux "libGL.so" file and the generic "libGLU.so" file that is shipped with MATLAB in the $MATLABROOT/sys/opengl/lib/glnx86 directory (where $MATLAB is the root MATLAB directory).

Consult your system documentation to identify the location of your native Linux OpenGL libraries. They are files or symbolic links called "libGL.so" and they are usually located in a directory such as /usr/lib or a similar directory. This native library may indicate Mesa software OpenGL, or may indicate a library that is specifically accelerated for your hardware. Later in this resolution, you will see how to determine which MATLAB is using.

Once you have identified these libraries, for example: /usr/lib/libGL.so and [YOUR_MATLAB_PATH]/sys/opengl/lib/glnx86/libGLU.so

you can create symbolic links in some_directory to these respective libraries using the UNIX linking utility. For example, assuming your native OpenGL Linux library "libGL.so" is located in /usr/lib and your MATLAB is installed in /usr/matlab, you would then do something such as this:
[TERMINAL] >> cd /usr/MATLAB_OpenGL
[TERMINAL] >> ln -s /usr/lib/libGL.so libGL.so
[TERMINAL] >> ln -s [YOUR_MATLAB_PATH]/sys/opengl/lib/glnx86/libGLU.so libGLU.so

And then edit your matlab configuration file where it is in [YOUR_MATLAB_PATH]/bin/matlab


[TERMINAL] >> sudo nano [YOUR_MATLAB_PATH]/bin/matlab

Find the line : # Determine for each platform and find the first export LD_LIBRARY_PATH , before this line , add

LD_LIBRARY_PATH=/usr/MATLAB_OpenGL:$LD_LIBRARY_PATH

And, then you can verify which OpenGL library file MATLAB is using by using the "ldd" command:

[TERMINAL] >> ldd /usr/matlab/bin/glnx86/glren.so

You can verify which renderer the libraries actually indicate by using the following command in MATLAB:

[MATLAB] >> opengl info

After you have determined what you are using for hardware, check which XVisual your MATLAB figure is using. You can use the following MATLAB commands:

[MATLAB] >> hf=figure;
set(hf,'renderer','opengl');
get(hf,'xvisual')
Output:
ans =
0x23 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)

Now cross-reference this number against the output of the UNIX command, glxinfo:

[MATLAB] >> !glxinfo
Output:

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat
----------------------------------------------------------------------
0x23 24 tc 0 24 0 r y . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x24 24 tc 0 24 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x25 24 tc 0 24 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x26 24 tc 0 24 0 r . . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x27 24 tc 0 24 0 r y . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x28 24 tc 0 24 0 r . . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x29 24 tc 0 24 0 r y . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow
0x2a 24 tc 0 24 0 r . . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow
0x2b 24 dc 0 24 0 r y . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x2c 24 dc 0 24 0 r . . 8 8 8 8 0 0 0 0 0 0 0 0 0 None
0x2d 24 dc 0 24 0 r y . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x2e 24 dc 0 24 0 r . . 8 8 8 8 0 24 8 0 0 0 0 0 0 None
0x2f 24 dc 0 24 0 r y . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x30 24 dc 0 24 0 r . . 8 8 8 8 0 0 0 16 16 16 0 0 0 Slow
0x31 24 dc 0 24 0 r y . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow
0x32 24 dc 0 24 0 r . . 8 8 8 8 0 24 8 16 16 16 0 0 0 Slow

You can see that a visual id of 0x23 has a depth ("dp th") of 0. This indicates that the patches do not get rendered in the proper order. The renderer is not paying attention to their depth within the monitor.

To fix this, choose the best TrueColor visual that has a depth and that has double buffering. A TrueColor visual has a "visual cl" value of "tc", and a double buffering visual has a "d b" value of "y".

In this case visual 0x25 has TrueColor, double buffering, 24bit Zbuffer ("bfsz"), and is not "slow".

The following code shows how to set this visual to all MATLAB figures. You may wish to put this line of code in a "startup.m" file:

[MATLAB] >> set(0,'defaultfigurexvisual','0x25');
and well done ! =)

References:
http://onurs.wordpress.com/tag/linux/
http://www.mathworks.com/support/solutions/en/data/1-18N21/index.html?solution=1-18N21

Projects - Installing Matlab on Linux

The version of matlab : Mathworks MATLAB V7.0 Release-14
Including:
* MathWorks_R14_1.iso
* MathWorks_R14_2.iso
* MathWorks_R14_3.iso
* license.dat
* license.lic

How to Install: commands for your terminal
* #mkdir -p /mnt/iso # make the mount point for ISOs
* #mount -o loop /path/to/Matlab_R14_Mac.Linux.Unix_CD1.iso /mnt/iso # mount the first ISO
* #mkdir -p /usr/local/matlab7/etc # make the installed directory for Matlab
* #cp /mnt/iso/Matlab.7.R14.License-Mac.OS.X-Unix-Linux/Matlab.7.R14.License-Mac.OS.X-Unix-Linux/* /usr/local/matlab7/etc/ # copy the licenses files (license.dat and license.lic)

Then modify the file license.lic with your own $HOSTNAME environment variable as follows:

#echo $HOSTNAME
FlyZhy.ouc.edu.cn
#chmod -R 755 /usr/local/matlab7
#vim /usr/local/matlab7/etc/license.lic
... ...
#cat /usr/local/matlab7/etc/licesne.lic
SERVER FlyZhy.ouc.edu.cn ANY 5353
VENDOR MLM

#
# Mathworks MATLAB V7.0 Release-14 License
#
# --------------------------------------------------------------------
#
# Mendling with Feature lines will only invalidate them!
# Don't forget to set MLM_LICENSE_FILE to point to the saved LICENSE.LIC
#
# --------------------------------------------------------------------
#
... ...

At last, getting started to install by typing the following command:

#cd /usr/local/matlab7/
#/mnt/iso/install
... ...

During the installation, answer the questions by clicking the suitable button when it pops up any windows with some questions. After it finishes the first ISO, it will prompt you to mount the second ISO by popping up a window, then you should mount the second ISO as it requires by typing:

#umount /mnt/iso # unmount the first ISO
#mount -o loop /path/to/Matlab_R14_Mac.Linux.Unix_CD2.iso /mnt/iso # mount the second ISO

Then click "OK" or something like that to continue the installation. After the second ISO is finished, just do the same operations to install the third ISO until it finished all the three ISOs. (Do it for the 3rd iso)

How to configure:

After finished the installation, try to type matlab in your shell, does it work? Of course not. You should do the last thing to make it work in GNU/Linux shell that is add the path "/usr/local/matlab7/bin" into your $PATH environment variable (maybe you should add "export PATH=$PATH:/usr/local/matlab7/bin" into your $HOME/.bashrc file and then execute it by the command . ~/.bashrc or source ~/.bashrc to make the change effect now).

If you are lucky to finish all the process without any error, congratulations and enjoy now.


#matlab # the default Matlab interface
#matlab -nojvm # the CLI mode of Matlab
#matlab -nodesktop # the same as above

Enjoy matlab on linux =)

Reference : http://www.zhyfly.org/projects/MatlabInstall.html

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...