help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a library/wrapper to expose .m files to the command line?


From: Helios de Rosario
Subject: Re: Is there a library/wrapper to expose .m files to the command line?
Date: Thu, 07 Apr 2016 11:14:50 +0200

>>> El día 06/04/2016 a las 16:18, Alejandro Garcia
<address@hidden> escribió:
> Is there a preferred way to expose a few .m files as programs from
the
> command line?
> I know you could use either:
> 
>   octave-cli --eval "myFunction(param1,param2)
> 
> or:
>    #!/usr/bin/octave -qf
> 
> 
> But is there a library that makes handling parmeters from the command
line
> easier?.

My suggestion is: write the command of your first option in a bash
script (or batch in Windows, etc.), but replacing "param1", "param2" by
"$1", "$2" (or "%1", "%2" in batch files). Then you can call the script
with the arguments you want in a very clean way.

If the arguments are not strings, perhaps you may have to modify your
.m file, or use a wrapper function in Octave that uses str2num, etc., to
pass on the arguments with the correct data type.

You can also use the bash script to do some things that Octave may need
to execute the .m file correctly, like for instance defining environment
variables before calling Octave or adding necessary paths.

Helios

INSTITUTO DE BIOMECÁNICA
Universitat Politècnica de València • Edificio 9C
Camino de Vera s/n • 46022 VALENCIA (ESPAÑA)
Tel. +34 961111170- +34 610567200 • Fax +34 96 387 91 69
www.ibv.org

Antes de imprimir este e-mail piense bien si es necesario hacerlo.
En cumplimiento de la Ley Orgánica 15/1999 reguladora de la Protección
de Datos de Carácter Personal, le informamos de que el presente mensaje
contiene información confidencial, siendo para uso exclusivo del
destinatario arriba indicado. En caso de no ser usted el destinatario
del mismo le informamos que su recepción no le autoriza a su divulgación
o reproducción por cualquier medio, debiendo destruirlo de inmediato,
rogándole lo notifique al remitente.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]