Path: news.mathworks.com!not-for-mail
From: "Irian O" <merlingt1@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to change startup directory in Matlab 7.5
Date: Mon, 17 Mar 2008 14:40:25 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 54
Message-ID: <frlvsp$dit$1@fred.mathworks.com>
References: <fqv437$s8b$1@fred.mathworks.com> <frlcsk$3lo$1@fred.mathworks.com>
Reply-To: "Irian O" <merlingt1@yahoo.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1205764825 13917 172.30.248.37 (17 Mar 2008 14:40:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 17 Mar 2008 14:40:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1308702
Xref: news.mathworks.com comp.soft-sys.matlab:457647


Thank you all,

I got it working by editing my startup.m everytime with the 
directory "cd('mydirectory')" which I wish to be in before 
I launch a new Matlab window. It is kind of a nuisance 
because with Matlab 7.0 I never had to do this and it 
automatically knew the last directory I was in. I am not 
sure if it is something that changed or if it is a program 
setting that I am missing.

Cheers!
Irian

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message 
<frlcsk$3lo$1@fred.mathworks.com>...
> "Irian O" <merlingt1@yahoo.com> wrote in message <fqv437
> $s8b$1@fred.mathworks.com>...
> > Hi everyone,
> > 
> > I have been the following commands in one of my codes:
> > 
> > !matlab -nosplash -r myscript &
> > 
> > This starts a new instance of Matlab and runs the 
script 
> > "myscript.m". The problem is that when the new Matlab 
> > window opens it starts in the default main Matlab 
> directory 
> > instead on the current or working directory when I ran 
> the 
> > "!matlab .... command". Does anyone know how I can 
> change 
> > it so it remembers in which directory the previous 
> working 
> > directory?
> > 
> 
> This is what you need
> doc startup
> doc finish
> doc pwd
> 
> You will need to code your finish.m file in such  a way 
> that when you close/exit matlab, it will execute the code 
> in it which has the reference to the present working 
> directory or pwd and then it outputs that string of the 
> pwd to startup.m file
> In your startup file, your code should be something like 
> this
> cd('<path string generated from finish.m>')
> HTH
> Vihang
>