Question
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?
Expert Answer
Neeta Dsouza
PhD Expert
Answered Sep 12, 2026
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.
The order of the hexagon numbers will start from the bottom left and work its way up to the top right, going by rows first.
So, if you now wanted to find which inputs a given neuron corresponded to, you could simply get the indices of 'input_neuron_mapping' equal to that neuron's number.
For example, if you wanted to see all of the inputs that neuron 7 classified:
>> neuron_7_input_indices = find(input_neuron_mapping == 7)
And if you wanted to find the values of those inputs:
>> neuron_7_input_values = x(neuron_7_input_indices)
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →