Set environment variable before startup

조회 수: 8 (최근 30일)
Iain
Iain 2011년 8월 12일
Hello,
I am running Matlab 2009a on Ubuntu 11.04.
I want to change the startup directory of matlab and I have found in the documentation the following instructions
"You can specify that the userpath be the startup directory by setting the value of the environment variable MATLAB_USE_USERPATH to 1 prior to startup. By default, userpath is userhome/Documents/MATLAB, and MATLAB automatically adds the userpath directory to the top of the search path upon startup."
How precisely do I change the value of the environment variable before startup? I am still a linux newbie, so detailed instructions would be greatly appreciated.
Many thanks
  댓글 수: 4
Daniel Shub
Daniel Shub 2011년 8월 14일
Are you starting MATLAB from the command line or from a launcher? If you are starting it from a launcher, what DE are you using (e.g., Gnome 2.x, Gnome 3, KDE, etc)?
Iain
Iain 2011년 8월 14일
I'm using it from a Launcher, but I don't mind using the command line. By DE I assume you mean Desktop Environment - I think its Unity under Ubuntu 11.04.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2011년 8월 14일
Edit your ~/.profile to contain
export MATLAB_USE_USERPATH=1
Beyond that, please see the section "Assigning userpath as the Startup Folder on a UNIX or Macintosh Platform" in userpath
  댓글 수: 3
Iain
Iain 2011년 8월 14일
I've solved the problem to my satisfaction. For some reason the startup.m file runs even if the startup directory isn't necessarily the directory containing startup.m, so putting
cd <desired current directory>
in startup.m makes it automatically go to the directory I want.
I would have thought that startup.m only runs in the startup directory - any explanations?
Walter Roberson
Walter Roberson 2011년 8월 14일
I do not know why it does that, but the userpath() documentation does say more than once that this userpath processing only applies if the userpath is not changed in startup.m, so it _is_ documented behavior.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by