How to execute .m files in Octave

In octave prompt, type run("file1.m") or entering the filename without .m extension.


In the Octave prompt, simply type file1.

Of course, you need to make sure Octave can recognize its path.


To run your Octave file in GNU Octave.

  1. navigate to editor tab at the bottom of command editor
  2. Press Ctrl+O or Go to file and open your file
  3. Pres F5 or Navigate to Run and Save and Run

You can see the logs in command window


There are two ways to execute a file in Octave ::

  1. Simply type the filename without extension .

  2. Type run("filename.m") in the command line of Octave .

    Then press ctrl + c to exit the file in middle of the run .

Example ::

File name here is  'ex1' which is being executed

Tags:

Matlab

Octave