question on runing octave script that uses function files in linux machine

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

question on runing octave script that uses function files in linux machine

Rui Pereira
Dear all,

I am just starting to migrate from Matlab in a PC to Octave in a Computer cluster.
I wrote a script say called script.m that invokes functions a1 and a2 that are
written in in separate files a1.m and a2.m.

If I want to run script in this computer cluster that has Linux, what is the command or
set of commands I have to type such that script runs and calls functions a1 and a2 correctly?

Thank you for helping me,
Rui

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: question on runing octave script that uses function files in linux machine

c.-2

On 19 Jun 2014, at 20:08, Rui Miguel Soares Pereira <[hidden email]> wrote:

> Dear all,
>
> I am just starting to migrate from Matlab in a PC to Octave in a Computer cluster.
> I wrote a script say called script.m that invokes functions a1 and a2 that are
> written in in separate files a1.m and a2.m.
>
> If I want to run script in this computer cluster that has Linux, what is the command or
> set of commands I have to type such that script runs and calls functions a1 and a2 correctly?

it is exactly the same you would do to run
the same script in matlab:

to start Octave, you just type "octave".
then, assuming your script is named "myscript.m",
just type "myscript" (i.e. the name of the script file
without the ".m" extension) at the Octave prompt.

> Thank you for helping me,
> Rui

HTH,
c.
_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: question on runing octave script that uses function files in linux machine

Alois Schloegl-7
On 06/20/2014 10:50 AM, c. wrote:

>
> On 19 Jun 2014, at 20:08, Rui Miguel Soares Pereira <[hidden email]> wrote:
>
>> Dear all,
>>
>> I am just starting to migrate from Matlab in a PC to Octave in a Computer cluster.
>> I wrote a script say called script.m that invokes functions a1 and a2 that are
>> written in in separate files a1.m and a2.m.
>>
>> If I want to run script in this computer cluster that has Linux, what is the command or
>> set of commands I have to type such that script runs and calls functions a1 and a2 correctly?
>

Instead of
  matlab -nojvm -nodisplay < mysqript.m

you need to do
  octave --eval "myscript.m"

Of course you need to make sure that functions a1, and a2 are in your
path. You can do that in your script or
in ~/.octaverc


Alois



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: question on runing octave script that uses function files in linux machine

Markus Bergholz


Am 20.06.2014 11:53 schrieb "Alois Schloegl" <[hidden email]>:
>
> On 06/20/2014 10:50 AM, c. wrote:
> >
> > On 19 Jun 2014, at 20:08, Rui Miguel Soares Pereira <[hidden email]> wrote:
> >
> >> Dear all,
> >>
> >> I am just starting to migrate from Matlab in a PC to Octave in a Computer cluster.
> >> I wrote a script say called script.m that invokes functions a1 and a2 that are
> >> written in in separate files a1.m and a2.m.
> >>
> >> If I want to run script in this computer cluster that has Linux, what is the command or
> >> set of commands I have to type such that script runs and calls functions a1 and a2 correctly?
> >
>
> Instead of
>   matlab -nojvm -nodisplay < mysqript.m
>
> you need to do
>   octave --eval "myscript.m"
>

Or
octave -q /path/to/file/myscript.m

> Of course you need to make sure that functions a1, and a2 are in your
> path. You can do that in your script or
> in ~/.octaverc
>
>
> Alois
>
>
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: question on runing octave script that uses function files in linux machine

c.-2
In reply to this post by Alois Schloegl-7

On 20 Jun 2014, at 11:52, Alois Schloegl <[hidden email]> wrote:

> you need to do
>  octave --eval "myscript.m"

that's actually

  octave --eval "myscript"

without the extension, the string passed to eval is interpreted as an Octave command,
not a file name.

c.
_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave