My guess is that you are asking kmeans for more clusters than you have data points (as per the error message in matlab).  


On 29 Aug 2017, at 12:48, Francesco Sammartino <[log in to unmask]> wrote:

thank you Saad and apologies if I misunderstood in the first place.
I checked my fdt_paths file and it does look correct (streamlines going from the seed through waypoint to cortex) so I assumed this was correct. Also in the .dot file the streamlines for each voxels are lower but still there are values..
Do you think this could not be enough?

thanks for following up
have a good day


Francesco Sammartino MD

On Aug 29, 2017 5:09 AM, "Saad Jbabdi" <[log in to unmask]> wrote:
Sorry I think I have not been clear.  I think that your inclusion of a waypoint has reduced the number of streamlines so much that it means you cannot run kmeans. You should check the results of your tractography (e.g. the fdt_paths).


On 25 Aug 2017, at 22:46, Francesco Sammartino <[log in to unmask]> wrote:

I see. How can I delete this extra row in your opinion?

thanks again

Francesco Sammartino MD

On Aug 25, 2017 9:41 AM, "Saad Jbabdi" <[log in to unmask]> wrote:
Hi - My guess is that the extra waypoint has made the matrix too sparse, so when matlab’s kmeans deletes the missing rows you end up with more clusters than data points?


On 19 Aug 2017, at 22:54, Francesco Sammartino <[log in to unmask]> wrote:

I used probtrackx2 to perform tractography from the subthalamic nucleus to 6 cortical areas with the omatrix1 option and a waypoint through the thalamus (thalamus as a whole mask - wyapoint 'AND'). Result: I am not able to perform clustering with Kmeans anymore following the instructions reported at

I get this error:
Warning: Ignoring rows of X with missing data. 
> In kmeans (line 164) 
Error using kmeans (line 269)
X must have more rows than the number of clusters.

The number of targetmasks is set to 6 so I have 6 clusters for Kmeans. The curious thing is that without waypoint it was working fine...

thanks a lot