Running matlab from linux platform with openGL

Hi,
I'm currently running matlab from the linux command line as follows:
>> opengl software
>> xyz.m
I had found out that using the openGL command enabled my figures to display otherwise the code would break since linux does not like graphical intensive procedures.
Now, I was wondering if I could avoid typing in this openGL command everytime I run my code by building it into the alias that I made for opening matlab from the linux command line. I am thinking something like this:
alias intmat = "/opt/matlab/R2011a/bin/matlab -nosplash -nodesktop -opengl"
So every time I invoke matlab it should be ready to handle graphics such as figures. The last switch "-opengl" won't work I think. Any suggestions? Is this even possible?

Respuestas (1)

Daniel Shub
Daniel Shub el 12 de Sept. de 2012

0 votos

First, it seems odd that you need to switch to software rendering. You should contact technical support so that they can look into making hardware rendering work.
To answer your question you can put opengl software in a number of places. The most common would be in startup.m This file is run at load time if MATLAB can find it on the path. Since this seems to be system dependent, a better place might be to edit matlabrc.m. This will affect all users independent of their startup preferences.

6 comentarios

shah72206
shah72206 el 12 de Sept. de 2012
I tried adding "opengl software" to the first line of my startup.m file but it didn't work. Could you give me details. Thanks.
You'll have to use the system command to issue a command to the command line (otherwise it will be interpreted as a matlab command), so the line in your startup.m file should read;
% Switch to software mode in opengl
system('opengl software');
shah72206
shah72206 el 12 de Sept. de 2012
I did that and well, now I get the following error message when just invoking matlab in linux (even before running my code):
/usr/bin/ksh: line 1: opengl: not found
Walter Roberson
Walter Roberson el 12 de Sept. de 2012
Kevin's comment is incorrect. The command you want is a MATLAB command, not a system command.
Daniel Shub
Daniel Shub el 13 de Sept. de 2012
My guess is that you didn't put it in the "correct" startup.m. That is why I suggested to edit matlabrc.m
Kevin Claytor
Kevin Claytor el 13 de Sept. de 2012
Editada: Kevin Claytor el 13 de Sept. de 2012
Whoops, yeah my apologies. Walter's right - I misinterpreted what you meant when you said "running linux from the command line".

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Performance en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 12 de Sept. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by