Octave error filename undefined near line x column y

This fixed the problem [at least for me, on Windows]:

Entering the following command in Octave:

>addpath(pwd)

before calling the script:

>ex1

There is more info here.


You need to also save the file as "fileName.m"

Octave doesn't recognize 'fileName.M'. It has to be a lower-case '.m' extension


Octave (I'm on 4.0.3) will return this error (undefined near line 1 column 1) if you have a capital letter in your path anywhere. For example, if you have a folder on Windows, with the name d:/Myfolder/octave and then you write this:

cd d:/myfolder/octave (note the small "m")

Then octave will fail.

You have to write exactly the windows path:

cd d:/Myfolder/octave

and octave will be fine

Tags:

Octave