% Example 3.6 Self-Organizing Map

% Use the oronsay data set
load oronsay
% convert labels to cell array of strings.
for i = 1:length(beachdune)
    mid{i} = int2str(midden(i));
    % Use next one in exercises.
    bd{i} = int2str(beachdune(i));
end
% Normalize each variable to have unit variance and mean 0.
D = som_normalize(oronsay,'var');
sD = som_data_struct(D);
sD = som_set(sD,'labels',mid');
% Make the SOM
sM = som_make(sD);
sM = som_autolabel(sM,sD,'vote');
som_show(sM,'umat','all');
som_show_add('label',sM,'subplot',1);

