out =
tblish.sizeof2 (x)
¶Approximate size of an array in bytes, with object support.
This is an alternative to Octave’s sizeof
function that tries to provide
meaningful support for objects, including the classes defined in Tablicious. It is
named "sizeof2" instead of "sizeof" to avoid a "shadowing core function" warning
when loading Tablicious, because it seems that Octave does not consider packages
(namespaces) when detecting shadowed functions.
This may be supplemented or replaced by sizeof
override methods on Tablicious’s
classes. I’m not sure whether Octave’s sizeof
supports extension by method
overrides, so I’m not doing that yet. If that happens, this sizeof2
function
will stick around in a deprecated state for a while, and it will respect those override
methods.
For tables, this returns the sum of sizeof
for all of its variables’
arrays, plus the size of the VariableNames and any other metadata stored in obj.
This is currently broken for some types, because its implementation is in transition from overridden methods on Tablicious’s objects to a separate function.
This is not supported, fully or at all, for all input types, but it has support for the types defined in Tablicious, plus some Octave built-in types, and makes a best effort at figuring out user-defined classdef objects. It currently does not have extensibility support for customization by classdef classes, but that may be added in the future, in which case its output may change significantly for classdef objects in future releases.
x is an array of any type.
Returns a scalar numeric. Returns NaN for types that are known to not be supported, instead of raising an error. Raises an error if it fails to determine the size of an input of a type that it thought was supported.
See also: sizeof