Skill Tracer
Skills › Scientific Agent Skills › matlab › octave-compatibility.md

octave-compatibility.md

212 lines · skills/matlab/references/octave-compatibility.md at 5f2bc03

Open on GitHub
1# GNU Octave 11.3.0 Compatibility
2
3GNU Octave 11.3.0 is the current stable release as of 2026-10-01 (released
42026-06-01). It is free software under GPLv3+. MATLAB R2026a is proprietary.
5Do not describe Octave as MATLAB, a licensed toolbox substitute, or a
6drop-in guarantee.
7

GNU Octave 11.3.0 Compatibility

GNU Octave 11.3.0 is the current stable release as of 2026-10-01 (released 2026-06-01). It is free software under GPLv3+. MATLAB R2026a is proprietary. Do not describe Octave as MATLAB, a licensed toolbox substitute, or a drop-in guarantee.

Raw lines 1 to 7
8## Compatibility policy
9
10Use three labels:
12- **portable subset**: tested in both exact target versions;
13- **MATLAB-only**: depends on MATLAB syntax, objects, projects, products, or
14 deployment;
15- **Octave-only**: uses Octave syntax, packages, BIST, or runtime behavior.
17Source resemblance is not enough. Compare outputs with scientific tolerances,
18edge cases, warnings, graphics, performance, and file round trips.

Compatibility policy

Use three labels:

  • portable subset: tested in both exact target versions;
  • MATLAB-only: depends on MATLAB syntax, objects, projects, products, or deployment;
  • Octave-only: uses Octave syntax, packages, BIST, or runtime behavior.

Source resemblance is not enough. Compare outputs with scientific tolerances, edge cases, warnings, graphics, performance, and file round trips.

Raw lines 8 to 19
20## Current release changes
22Octave 11 introduced improved `classdef` support, broadcasting for sparse,
23diagonal, and permutation matrices, more MATLAB-compatible `nanflag`/`vecdim`
24behavior, and many function/performance changes. It is still not fully
25compatible. NEWS-11 also records behavior changes that can break older Octave
26code, including stricter accepted types for several statistics functions.
28Read both the current manual and NEWS before migrating to 11.3.0. The online
29`latest` manual reviewed on this date identifies its generated content as
3011.1.0 while the project download/news page identifies 11.3.0 as current;
31consult NEWS-11 for the maintenance-release delta.

Current release changes

Octave 11 introduced improved classdef support, broadcasting for sparse, diagonal, and permutation matrices, more MATLAB-compatible nanflag/vecdim behavior, and many function/performance changes. It is still not fully compatible. NEWS-11 also records behavior changes that can break older Octave code, including stricter accepted types for several statistics functions.

Read both the current manual and NEWS before migrating to 11.3.0. The online latest manual reviewed on this date identifies its generated content as 11.1.0 while the project download/news page identifies 11.3.0 as current; consult NEWS-11 for the maintenance-release delta.

Raw lines 20 to 32
33## Command-line differences
35Reviewed Octave argv usually includes:
37```text
38["octave", "--no-init-all", "--no-history", "--quiet", "--no-gui", "main.m"]
39```
41The bundled planner returns argv but never executes it.
43Current manual behavior:
45- `--eval`/`-e` evaluates code and exits unless `--persist` is set;
46- a filename executes and exits;
47- `--no-gui` selects CLI;
48- `--no-window-system` disables graphics/window-system use;
49- `--no-init-all`/`--norc` skips system and user initialization;
50- `--path` adds a function path;
51- `--quiet` suppresses greeting; `--no-history` avoids history writes.
53Octave startup can execute site/version files, user configuration,
54project-local `.octaverc`, and MATLAB-compatible `startup.m`. Skipping all
55startup files can improve reproducibility but can also remove expected package
56or path setup. Review the plan.
58MATLAB uses `-batch`, has different startup processing, and has no Octave
59`--no-init-all` option. Never pass the same flags to both.

Command-line differences

Reviewed Octave argv usually includes:

["octave", "--no-init-all", "--no-history", "--quiet", "--no-gui", "main.m"]

The bundled planner returns argv but never executes it.

Current manual behavior:

  • --eval/-e evaluates code and exits unless --persist is set;
  • a filename executes and exits;
  • --no-gui selects CLI;
  • --no-window-system disables graphics/window-system use;
  • --no-init-all/--norc skips system and user initialization;
  • --path adds a function path;
  • --quiet suppresses greeting; --no-history avoids history writes.

Octave startup can execute site/version files, user configuration, project-local .octaverc, and MATLAB-compatible startup.m. Skipping all startup files can improve reproducibility but can also remove expected package or path setup. Review the plan.

MATLAB uses -batch, has different startup processing, and has no Octave --no-init-all option. Never pass the same flags to both.

Raw lines 33 to 60
61## Syntax: portable versus Octave-only
63Prefer:
65- `%` comments;
66- `...` continuation;
67- `end` block terminators;
68- explicit `x = x + 1`;
69- intermediate variables before indexing a function result;
70- short-circuit `&&`/`||` for scalar conditions;
71- ordinary `.m` functions with matching filenames.
73Avoid these Octave-only extensions in portable code:
75- `#` comments;
76- `endif`, `endfor`, `endfunction`;
77- `++`, `--`, `+=`, and related compound assignment;
78- `do ... until`;
79- indexing directly into an expression result;
80- backslash line continuation;
81- Octave package/BIST directives in MATLAB production files unless isolated.
83Both support implicit expansion/broadcasting in many modern cases, but special
84classes and edge cases differ. Octave 11 expanded broadcasting for special
85matrix types. Test orientation, sparse output, empty dimensions, and mixed
86classes in both.

Syntax: portable versus Octave-only

Prefer:

  • % comments;
  • ... continuation;
  • end block terminators;
  • explicit x = x + 1;
  • intermediate variables before indexing a function result;
  • short-circuit &&/|| for scalar conditions;
  • ordinary .m functions with matching filenames.

Avoid these Octave-only extensions in portable code:

  • # comments;
  • endif, endfor, endfunction;
  • ++, --, +=, and related compound assignment;
  • do ... until;
  • indexing directly into an expression result;
  • backslash line continuation;
  • Octave package/BIST directives in MATLAB production files unless isolated.

Both support implicit expansion/broadcasting in many modern cases, but special classes and edge cases differ. Octave 11 expanded broadcasting for special matrix types. Test orientation, sparse output, empty dimensions, and mixed classes in both.

Raw lines 61 to 87
88## MATLAB features with no assumed Octave equivalent
90The current Octave manual does not establish drop-in equivalents for:
92- MATLAB `arguments` blocks and all validators/name-value semantics;
93- `table`/`timetable` workflows and their R2026a JSON conversions;
94- MATLAB Projects, dependency analyzer, Project Upgrade, or project-aware
95 `runtests`;
96- `matlab.unittest`, MATLAB Test, Code Quality Dashboard;
97- live scripts `.mlx`, App Designer `.mlapp`, `.fig` object compatibility;
98- Simulink and MathWorks toolbox APIs;
99- MATLAB Engine API for Python, MATLAB Compiler/Runtime, MATLAB Coder, or
100 MathWorks deployment products;
101- full MATLAB `classdef`, events/listeners, serialization, and metaclass
102 behavior.
104Use feature detection and separate adapters only after testing. Do not silently
105replace a missing MATLAB toolbox function with a similarly named Octave
106package function.

MATLAB features with no assumed Octave equivalent

The current Octave manual does not establish drop-in equivalents for:

  • MATLAB arguments blocks and all validators/name-value semantics;
  • table/timetable workflows and their R2026a JSON conversions;
  • MATLAB Projects, dependency analyzer, Project Upgrade, or project-aware runtests;
  • matlab.unittest, MATLAB Test, Code Quality Dashboard;
  • live scripts .mlx, App Designer .mlapp, .fig object compatibility;
  • Simulink and MathWorks toolbox APIs;
  • MATLAB Engine API for Python, MATLAB Compiler/Runtime, MATLAB Coder, or MathWorks deployment products;
  • full MATLAB classdef, events/listeners, serialization, and metaclass behavior.

Use feature detection and separate adapters only after testing. Do not silently replace a missing MATLAB toolbox function with a similarly named Octave package function.

Raw lines 88 to 107
108## Packages versus toolboxes
110Octave packages are distributed separately from core Octave. MATLAB toolboxes
111are separately licensed MathWorks products. APIs, algorithms, defaults,
112validation, object models, and release schedules differ.
114Never run `pkg install`, load an untrusted package, or alter `.octaverc`
115automatically. Package installation can fetch/build/execute code. Record exact
116package name/version/source/checksum and obtain approval.
118`pkg load` mutates the function path and can shadow core or project functions.
119Test `which`/resolution only in a trusted approved runtime.

Packages versus toolboxes

Octave packages are distributed separately from core Octave. MATLAB toolboxes are separately licensed MathWorks products. APIs, algorithms, defaults, validation, object models, and release schedules differ.

Never run pkg install, load an untrusted package, or alter .octaverc automatically. Package installation can fetch/build/execute code. Record exact package name/version/source/checksum and obtain approval.

pkg load mutates the function path and can shadow core or project functions. Test which/resolution only in a trusted approved runtime.

Raw lines 108 to 120
121## Tests
123Octave's built-in self-test system scans `%!` blocks and uses `test`. It is not
124`matlab.unittest`.
126```matlab
127%!test
128%! observed = hypot(3, 4);
129%! assert(observed, 5, 1e-12);
130```
132Portable production functions and runtime-specific test harnesses should be
133separate when test syntax differs. The nonexecuting planner can prepare an
134Octave BIST argv, but an approved runtime is required to run it.

Tests

Octave's built-in self-test system scans %! blocks and uses test. It is not matlab.unittest.

%!test
%! observed = hypot(3, 4);
%! assert(observed, 5, 1e-12);

Portable production functions and runtime-specific test harnesses should be separate when test syntax differs. The nonexecuting planner can prepare an Octave BIST argv, but an approved runtime is required to run it.

Raw lines 121 to 135
136## MAT and HDF5 compatibility
138Octave 11 supports writing MATLAB v4, v6, and v7 binary formats. It **does not
139implement saving MATLAB v7.3**.
141Octave can save its own HDF5 representation when built with HDF5. Its `load
142-hdf5` has limited ability to read MATLAB v7.3, mainly for supported numeric
143content; many types are unsupported. An Octave HDF5 file is not automatically
144a MATLAB v7.3 file.
146Octave's current manual states that `classdef` objects are saved as structures
147in supporting formats and are not restored as `classdef` objects. This differs
148substantially from MATLAB object serialization.
150Never load untrusted MAT/HDF5 files in either runtime. Use the bundled bounded
151technical inventory first, then escalate object/opaque/function/external-link
152content.
154For portable simple data, use MATLAB v7 only after testing classes, shapes,
155text, sparse/complex values, and metadata. Prefer schema-documented
156language-neutral formats where feasible.

MAT and HDF5 compatibility

Octave 11 supports writing MATLAB v4, v6, and v7 binary formats. It does not implement saving MATLAB v7.3.

Octave can save its own HDF5 representation when built with HDF5. Its load -hdf5 has limited ability to read MATLAB v7.3, mainly for supported numeric content; many types are unsupported. An Octave HDF5 file is not automatically a MATLAB v7.3 file.

Octave's current manual states that classdef objects are saved as structures in supporting formats and are not restored as classdef objects. This differs substantially from MATLAB object serialization.

Never load untrusted MAT/HDF5 files in either runtime. Use the bundled bounded technical inventory first, then escalate object/opaque/function/external-link content.

For portable simple data, use MATLAB v7 only after testing classes, shapes, text, sparse/complex values, and metadata. Prefer schema-documented language-neutral formats where feasible.

Raw lines 136 to 157
158## Graphics
160Basic calls such as `plot`, labels, legends, images, surfaces, and `print` are
161similar, but renderers, fonts, properties, layout, transparency, callbacks,
162and export formats differ.
164Do not assume Octave implements R2026a `exportgraphics`, SVG/HTML web canvas,
165`tiledlayout`, UI objects, or property behavior. Build a small compatibility
166test and compare exported dimensions, font embedding, vector/raster content,
167colors, and clipping.
169Octave 11 NEWS documents graphics compatibility changes such as colorbar and
170event-field behavior. Review NEWS for each update.

Graphics

Basic calls such as plot, labels, legends, images, surfaces, and print are similar, but renderers, fonts, properties, layout, transparency, callbacks, and export formats differ.

Do not assume Octave implements R2026a exportgraphics, SVG/HTML web canvas, tiledlayout, UI objects, or property behavior. Build a small compatibility test and compare exported dimensions, font embedding, vector/raster content, colors, and clipping.

Octave 11 NEWS documents graphics compatibility changes such as colorbar and event-field behavior. Review NEWS for each update.

Raw lines 158 to 171
172## Numerical differences
174Even when both runtimes call similarly named LAPACK/BLAS-backed functions,
175results can differ because of:
177- linked libraries, versions, threads, and architecture;
178- solver implementation/default/tolerance changes;
179- sparse ordering and pivot choices;
180- random generator algorithms and streams;
181- toolbox/package algorithms;
182- floating reduction order;
183- unsupported or converted classes.
185Compare residuals, invariants, objective/feasibility, and domain observables.
186Do not demand identical eigenvector signs, cluster bases, or bitwise
187floating-point output without a justified contract.

Numerical differences

Even when both runtimes call similarly named LAPACK/BLAS-backed functions, results can differ because of:

  • linked libraries, versions, threads, and architecture;
  • solver implementation/default/tolerance changes;
  • sparse ordering and pivot choices;
  • random generator algorithms and streams;
  • toolbox/package algorithms;
  • floating reduction order;
  • unsupported or converted classes.

Compare residuals, invariants, objective/feasibility, and domain observables. Do not demand identical eigenvector signs, cluster bases, or bitwise floating-point output without a justified contract.

Raw lines 172 to 188
189## Portability checklist
191- [ ] Exact MATLAB and Octave versions recorded.
192- [ ] Core versus toolbox/package requirements separated.
193- [ ] Only portable syntax used in shared source.
194- [ ] Shapes, missing values, strings, and implicit expansion tested.
195- [ ] RNG algorithm/seed behavior tested separately.
196- [ ] Numerical tolerances justified.
197- [ ] MAT/HDF5 round trips cover every used class.
198- [ ] Graphics compared from exported files.
199- [ ] Runtime-specific tests and deployment kept separate.
200- [ ] No package installation or code execution occurred implicitly.

Portability checklist

  • [ ] Exact MATLAB and Octave versions recorded.
  • [ ] Core versus toolbox/package requirements separated.
  • [ ] Only portable syntax used in shared source.
  • [ ] Shapes, missing values, strings, and implicit expansion tested.
  • [ ] RNG algorithm/seed behavior tested separately.
  • [ ] Numerical tolerances justified.
  • [ ] MAT/HDF5 round trips cover every used class.
  • [ ] Graphics compared from exported files.
  • [ ] Runtime-specific tests and deployment kept separate.
  • [ ] No package installation or code execution occurred implicitly.
Raw lines 189 to 201
202## Sources (reviewed 2026-10-01)
204- [GNU Octave home/current release](https://octave.org/)
205- [GNU Octave 11 release notes](https://octave.org/NEWS-11.html)
206- [GNU Octave current manual](https://docs.octave.org/latest/)
207- [Command-Line Options](https://docs.octave.org/latest/Command-Line-Options.html)
208- [Startup Files](https://docs.octave.org/latest/Startup-Files.html)
209- [Simple File I/O and MAT v7.3 limitation](https://docs.octave.org/latest/Simple-File-I_002fO.html)
210- [`classdef` compatibility status](https://docs.octave.org/latest/classdef-Classes.html)
211- [Test Functions](https://docs.octave.org/latest/Test-Functions.html)
212- [GNU GPL](https://octave.org/license.html)