views:

261

answers:

3

How can i pass command line arguments to a standalone MATLAB executable running on Linux/UNIX? I need to compile my MATLAB script as a standalone file that can be run on a machine without matlab present. It needs to be able to work in a way similar to C's argv[], where you do the following:

COMMAND LINE:

myfile argument1.txt argument2.txt

where argument 1 and 2 are the input and output files.

The exact syntax doesn't matter, but it should work like argv[]. I really need help with this. A function that could do this would be appreciated.

+1  A: 

You can't really run Matlab on a computer without Matlab. You can install the MCR (Matlab Component Runtime), which is free to install, and run Matlab programs. To build a 'standalone' executable you'll also need the Matlab compiler.

Once you have all that Matlab has all the facilities you need to handle command line arguments in the way your require.

High Performance Mark
A: 

What i mean is that I have matlab on my computer, but I need to make an standalone executable that can run on UNIX systems WITHOUT matlab on those computers. (it's a cluster, that only has matlab on one node). I need to find a way to make varargin function without having matlab installed on the computer that's running the program.If i can tell matlab to put the matlab library in each executable, that's OK, as long as its a complete standalone package.

Pilotbaxter007
A: 

I am looking for something very similar to this. As far as I can tell, you can

1) Write a script, which cannot take any arguments, and run that from the command line like this:

http://www.mathworks.com/support/solutions/en/data/1-15HNG/index.html

2) Write a function, which can take arguments from the Matlab Command line, but cannot be run from a Unix command line.

But for some reason, you cannot give arguments to 1) or run 2) from the Unix command line. Either of these solutions would work for what I'm doing (and from what it sounds like, what you're doing). Does anyone know if either of these are possible?

alexpelan

related questions