Mat File Reader
Last published: February 27, 2020 by 'nice'
Defines 13 Classes
Extends 8 Classes
Give the ability to read a Mat-File from Matlab and import its data in Smalltalk.
A Mat-File is a binary output file from Matlab which stores Matlab data from a workspace, and is obtained via the Matlab save command.
Workspace data is a list of name-value pairs, which acts as a Namespace in Smalltalk.
Values can be of various kind, mainly:
- numeric array (including matrix),
- character array,
- logical array,
- array of structure (sort of name-value dictionary)
- cell array (a composite array)
All these values can be organized as a multi-dimensional array, so we naturally use an equivalent MultipleDimensionArray class for importing data in Smalltalk.
For numeric arrays, instances of RawArray are used as the basic underlying storage, so as to have an efficient storage.
For cell arrays, instances of Array are used for storage.
For structures and objects, recipient Smalltalk classes are created on the fly and automatically reclaimed when no more used.
So the struct are stored into Array of MatFileStructureElement.
These values are wrapped in stubs (MxArray subclasses), except for scalar values and simple String.
So far, those stub don't have much behaviour and could as well be short-circuited.
The idea is rather to subclass the MatFileReader so as to import data into alternative target Smalltalk classes (i.e. to some Matrix package...), see #makeNumericValues: for example.
This packages reads:
- the traditional Level 5 Mat-File format (-v6 and -v7) as produced by Matlab R8 up to current version
- the old fashioned Level 4 Mat-File format of previous releases.
The -v7.3 format is a HDF5 format and is not read by this version.
The format is further described in:
Matlab is a registered trademark from Mathworks.