Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: "Change directory" dialog box
Date: Fri, 9 Oct 2009 14:07:02 +0000 (UTC)
Organization: Universit&#228;t Bremen
Lines: 15
Message-ID: <hang26$11e$1@fred.mathworks.com>
References: <haidoe$mjn$1@fred.mathworks.com> <hal2l8$25f$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255097222 1070 172.30.248.35 (9 Oct 2009 14:07:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 Oct 2009 14:07:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1426778
Xref: news.mathworks.com comp.soft-sys.matlab:576248


"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <hal2l8$25f$1@fred.mathworks.com>...
> Dear Andre!
> 
> > is there any way (other than adding a line of code in every file) to set the MATLAB preferences such that the default behavior for running m-files is to change the current directory to the directory where the file is located ?
> 
> This behaviour would be really confusing!
> E.g. if you call FOPEN, the current directory would be matlabroot\toolboxmatlab\iofun\ and a file without a path is searched there. If you call FOPEN(WHICH(FileName)), the file is searched in matlabroot\toolbox\matlab\general at first...
> I think, the frequent changes when calling "SIN(a + ABS(b))" would slow down Matlab completely: The + should change the current folder to the location of "plus.m" --- except if [b] is an object with an own PLUS operator...


Allow me to disagree: the pop-up dialog only shows up if you are trying to run an m-file which is located in a directory which is not included in the path. If you run FOPEN, for example, MATLAB knows where to search for it.

When the dialog shows up and when you press "Change directory", I assume that MATLAB adds this directory temporarily to the path and removes it in the end. This is the behavior I would like to be possible to be set as default in some check box in the MATLAB Preferences.

Andre