Octave provides a convenient command line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB.

Most everything in MATLAB is supported in Octave, and can be used in scripting, minus a few exceptions

IO test cases work very well with MATLAB.

Here is an example FizzBuzz project in MATLAB:

function fizzBuzz(x)
    for i = (1:x)
        if mod(i, 15) == 0
           fprintf('FizzBuzz\n')
        elseif mod(i, 3) == 0
           fprintf('Fizz\n')
        elseif mod(i, 5) == 0
           fprintf('Buzz\n')
        else
           fprintf('%i\n', i)
        end
    end
    fprintf('\n');
end

x = input("x: ")
fizzBuzz(x)

This creates a function called 'fizzBuzz' that takes an integer and does the FizzBuzz algorithm until that number, which is read into a standard in.

To create a simple test for this, zip and upload this perfect code, then you can set up an IO test like so:

In the main file name, be sure to specify the .m file you have uploaded. Keep in mind that the name of this file needs to be the same for your students' submissions, meaning you need to tell them to name their file the same thing. This is not 100% required for single file projects, but when you have more than one file your students may run into issues with the way the grader attempts to find files, so it is best practice to just have them follow your naming conventions. Also, while Mimir will work for most directory structures, it is best practice to keep the main file at the root of the zip file, meaning it is not within another directory. 

In the input field, insert the input you want to be fed to the program. In our case, we have entered 100. Just below that is the automatically generate output option, which we will leave on. This means that if your code compiles and runs, it will assume it is correct, and auto-set the expected output for you.

When you have all of your other options set as you like them, you can save the test case. Now you have the base of a functioning MATLAB script project!

Did this answer your question?