Results 1 to 6 of 6

Thread: Octave 3.0 - Can't run .m files

  1. #1
    Join Date
    Nov 2006
    Location
    Las Vegas, NV
    Beans
    117
    Distro
    Ubuntu 10.04 Lucid Lynx

    Octave 3.0 - Can't run .m files

    I can't get even the simplest program to run in Octave 3.0. Version 2 seemed ok. It runs most of the files I created in school last year in MATLAB, but if I try to write a file it doesnt' run, regardless of the file extension.

    For example, I open Kate, or any other editor and type:
    Code:
    % Test file
    disp('This is a test')
    I save the file as testfile, and this is the result I get when I try to run it:

    Code:
    octave:1> testfile
    error: `testfile' undefined near line 1 column 1

  2. #2
    Join Date
    Jan 2008
    Beans
    23

    Re: Octave 3.0 - Can't run .m files

    PHP Code:
    test file
    disp
    ('This is a tester File::::!')
    = [3 4 5
         6 7 8
         9 2 1

    Code:
    $ octave -q test.m 
    This is a tester File::::!
    A =
    
       3   4   5
       6   7   8
       9   2   1
    Does testfile.m at the prompt work?

    Also make sure you are in the directory you saved it in pwd and cd work like normal in octave

  3. #3
    Join Date
    Nov 2006
    Location
    Las Vegas, NV
    Beans
    117
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Octave 3.0 - Can't run .m files

    Hey, it almost worked that time. Sometimes it works, and sometimes it doesn't. Last night I spent hours and couldn't get anything to run unless I copied and pasted into the octave window.

    Code:
    octave:1> testfile.m
    This is a tester File::::!
    A =
    
       3   4   5
       6   7   8
       9   2   1
    
    error: can't perform indexing operations for <unknown type> type
    Last edited by rg_stephens; May 7th, 2009 at 01:47 AM.

  4. #4
    Join Date
    Nov 2006
    Location
    Las Vegas, NV
    Beans
    117
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Octave 3.0 - Can't run .m files

    Ok, this time I'm certain that I'm in the correct directory. I type a file using gedit, save it to the 'octave' folder, run 'ls' to make sure it's there, and when I try to run it, ...

    Code:
    % Test file
    m = 1
    x = m+1;
    disp(x)
    Code:
    octave:3> Adding.txt 
    error: `Adding' undefined near line 3 column 1
    Also, the exist command doesn't work. Am I missing something?
    octave:5> exist Adding.txt
    parse error:

    syntax error

    >>> exist Adding.txt
    ^

  5. #5
    Join Date
    Mar 2007
    Location
    Finland
    Beans
    256
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Octave 3.0 - Can't run .m files

    M-files need to have .m extension... Name your file to Adding.m and it should work.

  6. #6
    Join Date
    Apr 2010
    Beans
    15

    Re: Octave 3.0 - Can't run .m files

    Might be a problem with the file extension. Octave does not run .M files. Must be .m
    I consider this 'system feature' an (annoying) bug. (My DOS based data acquisition system unavoidably generates .M files).
    People from the W#%dows environment will have more difficulty with getting used to this this. Linux is case sensitive, also in the file extension.
    In an open source world, who needs gates and windows?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •