LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple clustering

Solved!
Go to solution

Hi

 

I am generating a stream of six numbers where three of them are spaced out quite evenly whereas the other three will be clustered quite close to one another. Can anyone suggest a method that will find the average value (or centroid) of the cluster of three? I have downloaded a clustering VI but I'm not quite getting the results I am after and the documentation isn't very good.

 

Many thanks

 

Jack

0 Kudos
Message 1 of 6
(2,583 Views)

Hi Jack,

 

this could be a solution:

check.png

I don't claim to offer the most optimized solution, but it seems to work for me.

The main point is: you need to learn to develop an algorithm to tackle your problem. See the comments given as explanation in the snippet!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,565 Views)

Hi jnaumann,

   Since you are generating stream of six numbers where 3 numbers are evenly spaced i.e. consider them as an aray and the remaining threee numbers as cluster of 3 numbers.So on a whole your generation of pattern should be an array of clusters where each cluster element contains an array of 3 numbers and cluster of three numbers.So now use a for loop to index each cluster and use unbundle functions to seperate array and cluster and use the Mean function to calculate the mean of those three numbers in the cluster.

 

Regards,

SrikrishnaNF

 

Regards,
Srikrishna


0 Kudos
Message 3 of 6
(2,559 Views)

Hi Jnaumann,

 

 Please find the attached Vi.

 

Regards,

SrikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 4 of 6
(2,553 Views)

Thats great - exactly what I was looking for. Just on query - when I have tried implementing this myself I have found I get a 2D array on the output from building my array as shown here. Do you know why that is happening? Cheers

labview_cluster.jpg

0 Kudos
Message 5 of 6
(2,549 Views)
Solution
Accepted by jnaumann

Hi JNaumann,

 

right-click is your friend!

Right-click BuildArray and choose "concatenate arrays"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(2,543 Views)