Path: news.mathworks.com!not-for-mail
From: "Joan " <jm3364@columbia.edu>
Newsgroups: comp.soft-sys.matlab
Subject: How to run matlab in a cluster from various folders
Date: Mon, 24 Dec 2012 09:59:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <kb991b$cje$1@newscl01ah.mathworks.com>
Reply-To: "Joan " <jm3364@columbia.edu>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1356343147 12910 172.30.248.46 (24 Dec 2012 09:59:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 24 Dec 2012 09:59:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3820921
Xref: news.mathworks.com comp.soft-sys.matlab:785325

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