Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to run matlab in a cluster from various folders
Date: Mon, 31 Dec 2012 00:22:02 -0500
Organization: MathWorks
Lines: 33
Message-ID: <kbr7dq$8b7$1@newscl01ah.mathworks.com>
References: <kb991b$cje$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: ah-slord.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="UTF-8";
	reply-type=response
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1356931322 8551 172.28.9.169 (31 Dec 2012 05:22:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 31 Dec 2012 05:22:02 +0000 (UTC)
In-Reply-To: <kb991b$cje$1@newscl01ah.mathworks.com>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:785661



"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