Thread Subject: Create setup m-file

Subject: Create setup m-file

From: Samb1985

Date: 30 Jul, 2009 14:00:19

Message: 1 of 12

I would like to create a m-file (setup.m), that will be located in the default matlab directory.
When I execute "setup" it must find on the pc a folder "MyApp" and add its path with all its subfolders to matlab search path, so I can run my matlab application without going on File - Set Path men?.

It is possible ? how ?

Thanks in advance.

Subject: Create setup m-file

From: Matt Fig

Date: 31 Jul, 2009 00:34:03

Message: 2 of 12

Why not just add your folder to the path once and for all? There is no need to do it every time. Go to File>Set Path

Subject: Create setup m-file

From: TideMan

Date: 31 Jul, 2009 01:37:03

Message: 3 of 12

On Jul 31, 12:34 pm, "Matt Fig" <spama...@yahoo.com> wrote:
> Why not just add your folder to the path once and for all?  There is no need to do it every time.  Go to File>Set Path

Matt has answered one aspect of your post, but another is that if you
create a file called startup.m and put it in the Matlab work
directory, that file will be executed everytime you run Matlab.
I have lots of stuff in my startup.m, including: cd to my Matlab
directory, default plotting options, setting random seeds, warning
off's, etc.

Subject: Create setup m-file

From: Samb1985

Date: 31 Jul, 2009 07:56:03

Message: 4 of 12

TideMan <mulgor@gmail.com> wrote in message <c6abdb05-a995-4840-b8a2-f42004658646@x25g2000prf.googlegroups.com>...
> On Jul 31, 12:34 pm, "Matt Fig" <spama...@yahoo.com> wrote:
> > Why not just add your folder to the path once and for all? There is no need to do it every time. Go to File>Set Path
>
> Matt has answered one aspect of your post, but another is that if you
> create a file called startup.m and put it in the Matlab work
> directory, that file will be executed everytime you run Matlab.
> I have lots of stuff in my startup.m, including: cd to my Matlab
> directory, default plotting options, setting random seeds, warning
> off's, etc.

I need to use the application in different Pc, so in different directory in each PC.
So I'm searching for a method that allow me to add the paths of application with a single command.
Otherwise i need to create different startup.m or pathdef.m for the different PC, that is the thing that I would like to automate.

Subject: Create setup m-file

From: us

Date: 31 Jul, 2009 09:17:03

Message: 5 of 12

"Samb1985 " <porro99@virgilio.it> wrote in message <h4u82j$mcj$1@fred.mathworks.com>...
> TideMan <mulgor@gmail.com> wrote in message <c6abdb05-a995-4840-b8a2-f42004658646@x25g2000prf.googlegroups.com>...
> > On Jul 31, 12:34 pm, "Matt Fig" <spama...@yahoo.com> wrote:
> > > Why not just add your folder to the path once and for all? There is no need to do it every time. Go to File>Set Path
> >
> > Matt has answered one aspect of your post, but another is that if you
> > create a file called startup.m and put it in the Matlab work
> > directory, that file will be executed everytime you run Matlab.
> > I have lots of stuff in my startup.m, including: cd to my Matlab
> > directory, default plotting options, setting random seeds, warning
> > off's, etc.
>
> I need to use the application in different Pc, so in different directory in each PC.
> So I'm searching for a method that allow me to add the paths of application with a single command.
> Otherwise i need to create different startup.m or pathdef.m for the different PC, that is the thing that I would like to automate.

a hint:

     help addpath; % <- and siblings...

us

Subject: Create setup m-file

From: Samb1985

Date: 31 Jul, 2009 21:14:02

Message: 6 of 12

> a hint:
>
> help addpath; % <- and siblings...
>
> us

I see the function addpath but i need to know the path of the folder. First i need to search the folder on the PC.

Subject: Create setup m-file

From: TideMan

Date: 31 Jul, 2009 22:04:40

Message: 7 of 12

On Aug 1, 9:14 am, "Samb1985 " <porr...@virgilio.it> wrote:
> > a hint:
>
> >      help addpath;     % <- and siblings...
>
> > us
>
> I see the function addpath but i need to know the path of the folder. First i need to search the folder on the PC.

So, you've put MyApps in some obscure place on your PC, and now you
can't find it.
Why is this a Matlab problem?

A better strategy would be to note where you put MyApps, and use
addpath to point Matlab to it.

Subject: Create setup m-file

From: us

Date: 31 Jul, 2009 23:15:05

Message: 8 of 12

TideMan <mulgor@gmail.com> wrote in message <d401755a-ef07-4be0-bd27-a583cb6d146c@13g2000prl.googlegroups.com>...
> On Aug 1, 9:14?am, "Samb1985 " <porr...@virgilio.it> wrote:
> > > a hint:
> >
> > > ? ? ?help addpath; ? ? % <- and siblings...
> >
> > > us
> >
> > I see the function addpath but i need to know the path of the folder. First i need to search the folder on the PC.
>
> So, you've put MyApps in some obscure place on your PC, and now you
> can't find it.
> Why is this a Matlab problem?

well, derek, we both realize: its an early sign of an insidious, neurodegenerative disease (aka dementia) - and, therefore, CSSMers have to be particularly patient and forgiving...

urs

Subject: Create setup m-file

From: TideMan

Date: 1 Aug, 2009 01:56:52

Message: 9 of 12

On Aug 1, 11:15 am, "us " <u...@neurol.unizh.ch> wrote:
> TideMan <mul...@gmail.com> wrote in message <d401755a-ef07-4be0-bd27-a583cb6d1...@13g2000prl.googlegroups.com>...
> > On Aug 1, 9:14?am, "Samb1985 " <porr...@virgilio.it> wrote:
> > > > a hint:
>
> > > > ? ? ?help addpath; ? ? % <- and siblings...
>
> > > > us
>
> > > I see the function addpath but i need to know the path of the folder. First i need to search the folder on the PC.
>
> > So, you've put MyApps in some obscure place on your PC, and now you
> > can't find it.
> > Why is this a Matlab problem?
>
> well, derek, we both realize: its an early sign of an insidious, neurodegenerative disease (aka dementia) - and, therefore, CSSMers have to be particularly patient and forgiving...
>
> urs

You mean like OldTimers' disease, urs?

Subject: Create setup m-file

From: Jonas

Date: 1 Aug, 2009 02:32:43

Message: 10 of 12

"Samb1985 " <porro99@virgilio.it> wrote in message <h4s91j$p6e$1@fred.mathworks.com>...
> I would like to create a m-file (setup.m), that will be located in the default matlab directory.
> When I execute "setup" it must find on the pc a folder "MyApp" and add its path with all its subfolders to matlab search path, so I can run my matlab application without going on File - Set Path men?.
>
> It is possible ? how ?
>
> Thanks in advance.

You can define an environment variable on your system that contains the path to MyApp. Then, you edit startup.m such that it recursively runs addpath.m on that directory.

Alternatively, you can use userpath.m to change the startup directory.

Subject: Create setup m-file

From: Rune Allnor

Date: 1 Aug, 2009 11:08:04

Message: 11 of 12

On 30 Jul, 16:00, "Samb1985 " <porr...@virgilio.it> wrote:
> I would like to create a m-file (setup.m), that will be located in the default matlab directory.
> When I execute "setup" it must find on the pc a folder "MyApp" and add its path with all its subfolders to matlab search path, so I can run my matlab application without going on File - Set Path men?.
>
> It is possible ? how ?
>
> Thanks in advance.

This is what STARTUP.M is supposed to do.

doc startup

Rune

Subject: Create setup m-file

From: Samb1985

Date: 2 Aug, 2009 19:33:03

Message: 12 of 12

Rune Allnor <allnor@tele.ntnu.no> wrote in message <7623506d-1bae-4967-8ed5-a62948e87521@f37g2000yqn.googlegroups.com>...
> On 30 Jul, 16:00, "Samb1985 " <porr...@virgilio.it> wrote:
> > I would like to create a m-file (setup.m), that will be located in the default matlab directory.
> > When I execute "setup" it must find on the pc a folder "MyApp" and add its path with all its subfolders to matlab search path, so I can run my matlab application without going on File - Set Path men?.
> >
> > It is possible ? how ?
> >
> > Thanks in advance.
>
> This is what STARTUP.M is supposed to do.
>
> doc startup
>
> Rune

If I use startup i need to know the path where MyApp is located. If i don't know it and i want to search and add it automatically ? i think it is impossible, so i will search for another solution.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
neurodegenerati... us 31 Jul, 2009 19:19:04
dementia us 31 Jul, 2009 19:19:04
reference us 31 Jul, 2009 05:19:05
mfile Samb1985 30 Jul, 2009 10:04:02
setup Samb1985 30 Jul, 2009 10:04:02
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com