Error: octave_base_value::load_binary for vector definition via ":"

Hi,

we (group of maintainers and users for our in-house software) want to switch to Octave 7.1 soon, and when we tested the compatibility of our software with Octave 7.1/6.4, we got an error in the load function.

To replicate:

in Octave 7.1:

A = 0:1;
save('testvar.mat','-binary','A')

switch to Octave 6.4

load('testvar.mat')
error: octave_base_value::load_binary(): wrong type argument '\<unknown type>'

It can also be replicated with any variant of (0:1) and (0:0.1:1). testvar.mat CAN be loaded with A=(0:1).';

I think this could be linked to this bug: GNU Octave - Bugs: bug #45833, support load/save of classdef... [Savannah], that’s why I wanted to ask here first if this downward incompatibility (?) was intended.

System/Version info

OS: Windows 10
7.1: GNU Octave Version: 7.1.0 (hg id: 04120d65778a), installed via .exe for Windows
6.4: GNU Octave Version: 6.4.0 (hg id: 8d7671609955), installed via .exe for Windows

I can confirm that regression.

If I inspect the files saved in Octave 7.1 vs. Octave 6.4, the latter contains the string range where the former contains the string double_range.
Afaict, the double_range type didn’t exist in Octave 6.4 which likely causes the file to fail loading in that version.
@jwe: Was that an intended change? Maybe related to the changes how ranges work during the development of Octave 7?
Maybe this change: octave: 95725e6ad9c1 (gnu.org)

Edit: @JZi: As a workaround, you could convert ranges to vectors before saving them to files. That could be done, e.g., by replacing A = 0:1; with A = [0:1];.

1 Like

While we do try to allow data files created by older versions of Octave to be loaded in more recent versions, we don’t guarantee that data files created by Octave can be loaded in an earlier version. New data types might not be supported in older versions. I see no way around that.

1 Like