# How do I find the indices of the Self Organizing Map (SOM) training set output?

When I create a SOM using the following:

`>> x = simplecluster_dataset;>> net = selforgmap([10 10]);>> net = train(net, x);`

I click “SOM Sample Hits”, the number in each hexagon shows how many data points are associated with each neuron. How can I know which samples in the input data (e.g. “x” in above example code) corresponding to the samples in each hexagon (neuron), or for the samples associated with a given hexagon (neuron), how can I know which samples they correspond to in the input data?

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

It may be easier for me to explain how to do the opposite first. That is, given each input, you can see which neuron the input is classified by. You can do so by doing the following:

`>> x = simplecluster_dataset;>> net = selforgmap([10 10]);>> net = train(net, x);>> % click on "SOM Sample Hits">> input_neuron_mapping = vec2ind(net(x))';`

At this point, ‘input_neuron_mapping’ will be a vector such that each input’s value is which neuron the input has been classified by. So, if ‘input_neuron_mapping(4)’ was 1, this would mean that the 4th input was classified by the first neuron, which, in the plot with the hexagons, is the bottom left hexagon. The second neuron would be the one to the right of the first, and so on.