Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Change default directory

Subject: Change default directory

From: sushma sharma

Date: 7 Apr, 2009 18:39:01

Message: 1 of 7

hi,

i am trying to run a .bat batch file. however using the following script:

matlab -r mfilename

causes matlab to open up in this directory : C:\Windows\system32

and as i result i'm getting many naming errors. how can i change this???

(i have tried right clicking a shortcut and changing the 'start in' directory. if i start matlab maually, it opens in the directory as specified by my modifying the properties on the icon).

however, when trying to run from a batch file, it still opens up in the C:\Windows\system32 directory!

HELP!!!

regards,

sushma

Subject: Change default directory

From: Praetorian

Date: 7 Apr, 2009 19:13:46

Message: 2 of 7

On Apr 7, 12:39=A0pm, "sushma sharma" <ssha...@ynospamahoo.com> wrote:
> hi,
>
> i am trying to run a .bat batch file. however using the following script:
>
> matlab -r mfilename
>
> causes matlab to open up in this directory : C:\Windows\system32
>
> and as i result i'm getting many naming errors. how can i change this???
>
> (i have tried right clicking a shortcut and changing the 'start in' direc=
tory. if i start matlab maually, it opens in the directory as specified by =
my modifying the properties on the icon).
>
> however, when trying to run from a batch file, it still opens up in the C=
:\Windows\system32 directory!
>
> HELP!!!
>
> regards,
>
> sushma

Try adding the following to your batch file:

cd <directory containing your batch file>
matlab -r mfilename



C:\Windows\system32 is the directory that contains cmd.exe which is
running your batch file.

HTH,
Ashish.

Subject: Change default directory

From: sushma sharma

Date: 7 Apr, 2009 19:25:02

Message: 3 of 7

thanks for the suggestion...but it doesn't make a difference.

desperate for help on this one!

Subject: Change default directory

From: sushma sharma

Date: 7 Apr, 2009 19:30:18

Message: 4 of 7

thanks for the suggestion...but it doesn't make a difference.

desperate for help on this one!

Subject: Change default directory

From: Praetorian

Date: 7 Apr, 2009 19:52:52

Message: 5 of 7

On Apr 7, 1:13=A0pm, Praetorian <ashish.sadanan...@gmail.com> wrote:
> On Apr 7, 12:39=A0pm, "sushma sharma" <ssha...@ynospamahoo.com> wrote:
>
>
>
> > hi,
>
> > i am trying to run a .bat batch file. however using the following scrip=
t:
>
> > matlab -r mfilename
>
> > causes matlab to open up in this directory : C:\Windows\system32
>
> > and as i result i'm getting many naming errors. how can i change this??=
?
>
> > (i have tried right clicking a shortcut and changing the 'start in' dir=
ectory. if i start matlab maually, it opens in the directory as specified b=
y my modifying the properties on the icon).
>
> > however, when trying to run from a batch file, it still opens up in the=
 C:\Windows\system32 directory!
>
> > HELP!!!
>
> > regards,
>
> > sushma
>
> Try adding the following to your batch file:
>
> cd <directory containing your batch file>
> matlab -r mfilename
>
> C:\Windows\system32 is the directory that contains cmd.exe which is
> running your batch file.
>
> HTH,
> Ashish.

Sorry, I meant

cd <directory containing your mfile>
matlab -r mfilename


Does that work?

Subject: Change default directory

From: sushma sharma

Date: 7 Apr, 2009 20:03:01

Message: 6 of 7

still no difference...
any help would be uber-appreciated!!!

sushma

Subject: Change default directory

From: Praetorian

Date: 8 Apr, 2009 13:12:14

Message: 7 of 7

On Apr 7, 2:03=A0pm, "sushma sharma" <ssha...@ynospamahoo.com> wrote:
> still no difference...
> any help would be uber-appreciated!!!
>
> sushma

Sorry, I don't know what else to try. Adding the CD command to the
batch file works for me. What version of MATLAB are you using?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us