Reads a Self-Organizing Map from an ascii file in SOM_PAK format.
sMap = som_read_cod(filename);
This function is offered for compatibility with SOM_PAK, a SOM
software package in C. It reads map files written in SOM_PAK format.
The SOM_PAK map file format is as follows. The first line must contain
the input space dimension, lattice type ('rect' or 'hexa'), map grid
size in x-direction, map grid size in y-direction, and neighborhood
function ('bubble' or 'gaussian'), in that order. The following lines
are comment lines, empty lines or data lines.
Each data line contains the weight vector of one map unit and its
labels. From the beginning of the line, first are values of the vector
components separated by whitespaces, then labels, again separated by
whitespaces. The order of map units in the file are one row at a time
from right to left, from the top to the bottom of the map (x-direction
first, then y-direction).
Comment lines start with '#'. Comment lines as well as empty lines are
ignored, except if the comment line starts with '#n'. In that case the
line should contain names of the vector components separated by
In the returned map struct, several fields has to be set to default
values, since the SOM_PAK file does not contain information on
them. These include map shape ('sheet'), mask ([1 ... 1]),
normalizations (none), trainhist (two entries, first with algorithm
'init' and the second with 'seq', both with data name 'unknown'),
possibly also component names ('Var1',...).
Required input parameters
filename (string) the name of the input file
sMap (struct) the resulting SOM struct
sMap = som_read_cod('map1.cod');