How to open script in Octave

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

How to open script in Octave

Alexandra Sachkova
Hi! I have a problem.
I have to open  script in Octave. I have read intstructions and I type the name of the script in the command like this:
octave-3.2.4.exe:1> XRF_Maps
XRF_Maps.m is a name of a script. Is it in the write directionary?
but it can`t open it. The program writes, that
error: "XRF_Maps" undefined near line 1 column 1
 What could be a problem?
Reply | Threaded
Open this post in threaded view
|

Re: How to open script in Octave

Sergei Steshenko




----- Original Message -----

> From: Alexandra Sachkova <[hidden email]>
> To: [hidden email]
> Cc:
> Sent: Sunday, April 6, 2014 11:04 AM
> Subject: How to open script in Octave
>
> Hi! I have a problem.
> I have to open  script in Octave. I have read intstructions and I type the
> name of the script in the command like this:
> octave-3.2.4.exe:1> XRF_Maps
> XRF_Maps.m is a name of a script. Is it in the write directionary?
> but it can`t open it. The program writes, that
> error: "XRF_Maps" undefined near line 1 column 1
> What could be a problem?
>


For starters try from Octave

source("/full/path/to/XRF_Maps.m");

, i.e. use 'source' command and provide in it full path to the file to be source'd.

Try 'help source' from Octave to read on the command.

Regards,
  Sergei.


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

Re: How to open script in Octave

James Sherman
In reply to this post by Alexandra Sachkova
On Sun, Apr 6, 2014 at 4:04 AM, Alexandra Sachkova <[hidden email]> wrote:
Hi! I have a problem.
I have to open  script in Octave. I have read intstructions and I type the
name of the script in the command like this:
octave-3.2.4.exe:1> XRF_Maps
XRF_Maps.m is a name of a script. Is it in the write directionary?
but it can`t open it. The program writes, that
error: "XRF_Maps" undefined near line 1 column 1
 What could be a problem?



--
View this message in context: http://octave.1599824.n4.nabble.com/How-to-open-script-in-Octave-tp4663513.html
Sent from the Octave - General mailing list archive at Nabble.com.

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

Hi Alexandra,

I think I should clarify something first.  Are you trying to *run* the script?  (i.e. have the script do whatever it is its supposed to do) Or are you trying to *open* it to edit or view the script?  If you're looking open the script to edit it, there is no editor built into octave, so just use whatever your favorite text editor is for that.

However, It looks like like you're trying to run this script.  So the first thing you should do is make sure that your current directory is the same as that of the script (well there are other ways, but this is the simplest).  Say your script is in the directory ~/scripts/  Then you'd just need to type at the octave prompt:

octave> cd ~/scripts/

To check to make sure you're in the right directory, you can type "pwd" (without the quotes) to see the name of the directory or "ls" to list the files and folders in that directory.  Then you can type your script filename just like you did (without the .m) and your script should run.

As an aside, octave-3.2 is quite old (about 5 years now), and you may run into bugs that have been fixed and such.  If possible I'd suggest installing a newer version which can be found here: https://www.gnu.org/software/octave/download.html

Hope this helps,

James Sherman


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

Re: How to open script in Octave

Alexandra Sachkova
In reply to this post by Sergei Steshenko
Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: How to open script in Octave

Alexandra Sachkova
In reply to this post by James Sherman
Thanks!