function sMap=sompak_init(sData,ft,init_type,cout,ct,xdim,ydim,topol,neigh)
%SOMPAK_INIT Call SOM_PAK initialization programs from Matlab.
%
% sMap=sompak_init(sData,ft,init_type,cout,ct,xdim,ydim,topol,neigh)
%
% ARGUMENTS ([]'s are optional and can be given as empty: [] or '')
% sData (struct) data struct
% (matrix) data matrix
% (string) filename
% [ft] (string) 'pak' or 'box'. Argument must be defined, if input
% file is used.
% init_type (string) string 'rand' or 'linear'
% [cout] (string) filename for output SOM, if argument is not defined
% (i.e. argument is '[]') temporary file '__abcdef' is
% used in operations and *it_is_removed* after
% operations!!!
% [ct] (string) 'pak' or 'box'. Argument must be defined, if output
% file is used.
% xdim (scalar) Number of units of the map in x-direction.
% ydim (scalar) Number of units of the map in y-direction.
% topol (string) string 'hexa' or 'rect'
% neigh (string) string 'bubble' or 'gaussian'.
%
% RETURNS
% sMap (struct) map struct
%
% Calls SOM_PAK initialization programs (randinit and lininit) from
% Matlab. Notice that to use this function, the SOM_PAK programs must
% be in your search path, or the variable 'SOM_PAKDIR' which is a
% string containing the program path, must be defined in the
% workspace. SOM_PAK programs can be found from:
% http://www.cis.hut.fi/research/som_lvq_pak.shtml
%
% See also SOMPAK_TRAIN, SOMPAK_SAMMON, SOMPAK_INIT_GUI,
% SOMPAK_GUI, SOM_LININIT, SOM_RANDINIT.
% Contributed to SOM Toolbox vs2, February 2nd, 2000 by Juha Parhankangas
% Copyright (c) by Juha Parhankangas
% http://www.cis.hut.fi/projects/somtoolbox/
% Juha Parhankangas 050100
nargchk(9,9,nargin);
NO_FILE = 0;
if isstruct(sData);
sData=sData.data;
elseif ~(isreal(sData) | isstr(sData))
error('Argument ''sData'' must be a struct or a real matrix.');
else