SOM Toolbox Online documentation http://www.cis.hut.fi/projects/somtoolbox/

som_data_struct

Purpose

 Creates a data structure. 

Syntax

Description

 Creates a data struct. The struct contains, in addition to the data
 matrix, component names, normalization operations for the components,
 labels for each vector, and a name for the whole data set. All of these
 can be given in the optional arguments of the function. If left
 unspecified, they are given default values. 

  Field         Type         Size / default value    
  ------------------------------------------------------------------------
   .type        (string)     'som_data'               
   .data        (matrix)     size dlen x dim             
   .name        (string)     'unnamed'
   .labels      (cellstr)    size dlen x m, {''; ''; ... ''}
   .comp_names  (cellstr)    size dim x 1, {'Variable1', 'Variable2', ...}
   .comp_norm   (cell array) size dim x 1, {[], [], ... []}
   .label_names (cellstr)    size m x 1, []

 '.type' field is the struct identifier. Do not change it.
 '.data' field is the data matrix, each row is one data vector
 '.name' field is the identifier for the whole data struct
 '.labels' field contains the labels for each of the vectors. The ith
         of '.labels' contains the labels for ith data vector. Note that 
         if some vectors have more labels than others, the others are
         are given empty labels ('') to pad the '.labels' array up.
 '.comp_names' field contains the names of the vector components
 '.comp_norm' field contains normalization information for each
         component. Each cell of '.comp_norm' is itself a cell array of
         normalization structs. If no normalizations are performed for 
         the particular component, the cell is empty ([]).
 '.label_names' is similar to .comp_names field holding the names for
         each data label column

Required input arguments

  D  (matrix) The data matrix, size dlen x dim. The data matrix may 
              contain unknown values, indicated by NaNs. 

Optional input arguments

  argID (string) Argument identifier string (see below).
  value (varies) Value for the argument (see below).

  The optional arguments can be given as 'argID',value -pairs as
  listed below. If an argument is given value multiple times, the
  last one is used.

   'labels'     (string array / cellstr) labels for each data vector,
                 size dlen x m
   'name'       (string) data name
   'comp_names' (string array / cellstr) component names, size dim x 1
   'comp_norm'  (cell array) normalization operations for each
                 component, size dim x 1. Each cell is either empty, 
                 or a cell array of normalization structs.
   'label_names'(string array / cellstr) label names, size m x 1

Output arguments

  sD (struct) the data struct

Examples

 Simplest case:
  D  = rand(8, 3); % 8 3-dimensional vectors
  sD = som_data_struct(D);

 With optional arguments, the other fields can be given values:
  labs   = cell(8, 1); labs{1, 1} = 'first_label';
  cnames = {'first'; 'second'; 'third'};

  sD = som_data_struct(D,'labels',labs,'name','a data struct');
  sD = som_data_struct(D,'comp_names',cnames);

See also

som_set Set values and create SOM Toolbox structs.
som_map_struct Create a map struct.