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:
How to run matlab in a cluster from various folders

Subject: How to run matlab in a cluster from various folders

From: Joan

Date: 24 Dec, 2012 09:59:07

Message: 1 of 4

Hi,
I am trying to run a matlab file "main.m" that is located in folder ~/home/matlab.
Ideally I want to locate an .sh file in ~/home that runs the matlab file main.m located in ~/home/matlab. How can I do it?

It is easy to do it when both my .sh file and matlab file are in the same folder. I then need to write

matlab -nodesktop -nosplash -r main

and it works fine. However I cannot find how to run something like

matlab -nodesktop -nosplash -r matlab/main

Thanks,
Joan

Subject: How to run matlab in a cluster from various folders

From: dpb

Date: 24 Dec, 2012 15:06:34

Message: 2 of 4

On 12/24/2012 3:59 AM, Joan wrote:
...

> ... I cannot find how to run something like
>
> matlab -nodesktop -nosplash -r matlab/main

...

Not certain but I'd start w/ a fully-qualified path/name

--

Subject: How to run matlab in a cluster from various folders

From: Steven_Lord

Date: 31 Dec, 2012 05:22:02

Message: 3 of 4



"Joan " <jm3364@columbia.edu> wrote in message
news:kb991b$cje$1@newscl01ah.mathworks.com...
> Hi, I am trying to run a matlab file "main.m" that is located in folder
> ~/home/matlab. Ideally I want to locate an .sh file in ~/home that runs
> the matlab file main.m located in ~/home/matlab. How can I do it?
>
> It is easy to do it when both my .sh file and matlab file are in the same
> folder. I then need to write
> matlab -nodesktop -nosplash -r main
>
> and it works fine. However I cannot find how to run something like
>
> matlab -nodesktop -nosplash -r matlab/main

http://www.mathworks.com/help/matlab/matlab_env/startup-options.html

"Enclose the statement in double quotation marks ("statement"). Use
semicolons or commas to separate multiple statements"

So "cd('/home/jm3364/matlab'); main" would work as the value for the -r
startup option.

Or create a startup.m file in the directory in which you start MATLAB and
have that script CD to the appropriate directory and call main.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: How to run matlab in a cluster from various folders

From: Joan

Date: 2 Jan, 2013 11:27:07

Message: 4 of 4

Thanks,

"Steven_Lord" <slord@mathworks.com> wrote in message <kbr7dq$8b7$1@newscl01ah.mathworks.com>...
>
>
> "Joan " <jm3364@columbia.edu> wrote in message
> news:kb991b$cje$1@newscl01ah.mathworks.com...
> > Hi, I am trying to run a matlab file "main.m" that is located in folder
> > ~/home/matlab. Ideally I want to locate an .sh file in ~/home that runs
> > the matlab file main.m located in ~/home/matlab. How can I do it?
> >
> > It is easy to do it when both my .sh file and matlab file are in the same
> > folder. I then need to write
> > matlab -nodesktop -nosplash -r main
> >
> > and it works fine. However I cannot find how to run something like
> >
> > matlab -nodesktop -nosplash -r matlab/main
>
> http://www.mathworks.com/help/matlab/matlab_env/startup-options.html
>
> "Enclose the statement in double quotation marks ("statement"). Use
> semicolons or commas to separate multiple statements"
>
> So "cd('/home/jm3364/matlab'); main" would work as the value for the -r
> startup option.
>
> Or create a startup.m file in the directory in which you start MATLAB and
> have that script CD to the appropriate directory and call main.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Tags for this Thread

No tags are associated with 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