3

I want to run a function - let's say test - inside my test.m file. I want to run this function using Octave from terminal. So, it should be something like:

$>/Users/me/octave/bin/octave test(param1,param2)?

How can I accomplish this? I can do that in Matlab. But I didn't find a way in Octave.

2 Answers 2

6

You can use octave --eval CODE

Sign up to request clarification or add additional context in comments.

Comments

2

Octave's docs on this can be found here. To run a function with input args:

  1. In Terminal cd to your working directory.
  2. Type octave to open an interactive session.
  3. ls to check that your function's file is in your working dir, cd to the dir if not.
  4. Type the function's name immediately followed by the input args in brackets in the correct order, Eg: >foo(100). Your function will then run, spitting out whatever you print as well as all the results for lines of code not ending with ;.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.