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 19:19:03 +0000 (UTC)
Organization: Universit&#228;t Heidelberg
Lines: 25
Message-ID: <hao2b7$fc6$1@fred.mathworks.com>
References: <haidoe$mjn$1@fred.mathworks.com> <hal2l8$25f$1@fred.mathworks.com> <3b8255ac-f7ba-4247-b877-3a98da564c7d@c3g2000yqd.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255115943 15750 172.30.248.38 (9 Oct 2009 19:19:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 Oct 2009 19:19:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869888
Xref: news.mathworks.com comp.soft-sys.matlab:576305


Dear ImageAnalyst!

> Well for me, I'd just as soon have it change directory immediately
> upon selecting the m-file that you're going to work with.  So you
> click on the filename in the "task bar" (or whatever you call it) and
> the code window switches to the code for that m-file, and then I'd
> like it to change the current folder right then - why wait until you
> run it (by clicking on the green triangle).  If you changed only after
> you ran it, then you have this intermediate state where the displayed
> code and the current folder don't match.  Then after you click "run"
> they do match.  So I don't want the discrepancy of having different
> current folders when looking at some code, depending on whether I ran
> the code or not.

There are 2 fundamental concepts for managing paths: the current directory and the "path" mechanism, which means a list of paths in a specific order to look for searches files in.
They are really good concepts, therefore we find them for a variety of operating systems and development environments. Of course Matlab must be compatible with these established concepts.

1. If I'm working with an M-file, I absolutely do not want the current folder to be changed. E.g. if I CD to a directory with the data file "TestData.mat" and debug the processing function, it would be a hard nonsense, if the file cannot be found anymore due to a missing absolute path. This would destroy the current directory concept!

2. When I hit the RUN button, the function should behave exactly as if it is called by a standard function call. Otherwise such difference would make the RUN button useless for me. The message, that a function is not in the current path, is valuable for me! E.g. it helps to detect an incomplete path definition. Neither changing the current path nor appending the current path to the Matlab PATH automatically would satisfy my expectations!

3. Running a function (from command line, main program or RUN button), path management and the current directory concept are 3 distinct jobs. Mixing them would reduce the power of the these concepts.

I hope the discussion goes on. Perhaps I miss some points in your ideas.
Kind regards, Jan