XCODX |

GNU Octave Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About GNU Octave

GNU Octave gives you MATLAB's language without MATLAB's license fee. A free-software project since the early 1990s, Octave deliberately tracks MATLAB syntax — matrices as the core type, the same operators, largely compatible function names — so the numerical methods course that assumes MATLAB usually runs fine in Octave. Recent major releases (Octave 9 and 10, 2024-2025) continue improving compatibility and performance. Universities and self-learners lean on it heavily: linear algebra, signal processing, and control systems homework are its natural habitat, and Andrew Ng's original machine learning course famously used it. This page runs Octave scripts in a real streaming terminal where input() prompts wait for your typed values — no download, no license, no setup.

Hello World in GNU Octave

name = input("Enter your name: ", "s");
printf("Hello, %s!\n", name);

n = input("Size of magic square? ");
M = magic(n);
disp("Your magic square:")
disp(M)
printf("Every row, column, and diagonal sums to %d\n", sum(M(1, :)));

v = input("Enter a vector like [3 1 4 1 5]: ");
printf("Mean %.2f | Max %g | Sorted: ", mean(v), max(v));
disp(sort(v));

When to use GNU Octave

Octave is the budget-savvy student's MATLAB: engineering programs assign matrix computations, ODE problems, least-squares fits, and control-theory exercises in MATLAB syntax, and Octave runs nearly all of it free. Use this page when the campus license server is down, when you're on a personal laptop without MATLAB, or when you just need to verify a matrix identity or test vectorized code quickly. It also suits ML fundamentals practice — implementing gradient descent or normal equations by hand in matrix notation remains one of the best ways to internalize the math.

Common questions

Do input() and keyboard interaction work in this terminal?

Yes. input() prints its prompt and suspends the script until you type a value — a number, an expression, or with the "s" flag a raw string — into the live terminal. Output from disp and printf streams immediately, so multi-prompt scripts read exactly like an interactive Octave session.

Will my MATLAB homework code run in Octave unchanged?

Usually, yes — core language syntax, matrix operations, and most common functions are compatible by design. Differences appear at the edges: some toolbox functions (Simulink, certain signal-processing extras) don't exist, and Octave allows a few extensions MATLAB rejects. For typical coursework in linear algebra and numerical methods, compatibility is excellent.

Can I plot graphs or install Octave Forge packages?

Graphical plot windows can't render in this text terminal, and pkg install is not available. Compute-side work is fully supported, so a common pattern is generating and printing the numeric results here (or checking them against a hand calculation), then producing the actual figure in a local Octave or MATLAB install.

How GNU Octave runs on XCODX

Sandbox filename
main.m
Entry point
single main source file
Editor grammar
text/x-octave
Reading stdin
input()
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

% GNU Octave (MATLAB-compatible)
printf("Hello from Octave!\n");
printf("Welcome to XCODX Compiler!\n");

% Matrix operations
A = [1 2 3; 4 5 6; 7 8 9];
printf("Matrix A:\n");
disp(A);
printf("Determinant: %f\n", det(A));
printf("Sum of all elements: %d\n", sum(A(:)));

% Vector math
x = linspace(0, pi, 5);
printf("sin values: ");
disp(sin(x));