help-octave
[Top][All Lists]
Advanced

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

Re: writing scripts


From: David Grundberg
Subject: Re: writing scripts
Date: Wed, 10 Feb 2010 17:13:25 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090812)

Matthew Lancellotti wrote:
hi!

I need to create a script file (i think its also called an m-file).  For 
example, let's say I wanted to make a function m-file with the commands:

function v = rvect(m)
v = fix(10*rand(m,1));

and i wanted to save it as "rvect.m".  Then, I want to be able to utilize the 
function when I work in Octave.

I am new to Octave, so I really have no idea how to do this.  Your help is 
greatly appreciated

thanks!

Mareo
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

The correct terminology would be "function file". Script files are also .m, but they are evaluated differently.

You got the idea right. What you need to do is to save the rvect.m in some good directory (arbitrary really, but you need to know the directory's path). At the Octave prompt, you want to make Octave recognize the directory. You can do this either by changing working directory (with the cd command) or adding the directory to the load path with the addpath command.

David



reply via email to

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