LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort and split arrays into new cluster-array?

Solved!
Go to solution

Hello,

i have three arrays A (integer), B (timestamp) and C (double).

Now i want to convert them into a cluster array. The size of the cluster-array is the number of different values in array A (here: two different values 1 and 2)

So index 0 of the cluster array contains integer 1 and two arrays with all values of the other two arrays where the index of array A is 1.

Index 1 of the cluster array contains integer 2 and two arrays with all values of the other two arrays where the index of array A is 2.

How can this be done?

 

Thanks and best regards

 

 

0 Kudos
Message 1 of 11
(3,829 Views)

Something like this?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 11
(3,815 Views)

edit 🙂

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 3 of 11
(3,804 Views)

No, the array-size of the output array equals the size of different numbers in array A.

 

In your screenshot the values of  B and C in index 2 should appear as array under index 0 as they have the same number in A.

 

A:

1

2

1

2

 

B

2009

2010

2011

2012

 

C

10

11

12

13

 

Cluster[0]

1

Timestamp[2009,2011]

Value[10,12]

 

Cluster[1]

2

Timestamp[2010,2012]

Value[11,13]

 

 

The values in A are not always in a order. They can be mixed like [1,2,1,2,1,1,1,1,2,2,1,2,1,2,2,2,2,1,1,1]

 

0 Kudos
Message 4 of 11
(3,801 Views)

How about this one:

 

image01.png

 

Regards, Jens

Kudos are welcome...
Message 5 of 11
(3,792 Views)
Solution
Accepted by OnlyOne

Here's a simple solution that uses the OpenG array tools.

 

CreateCluster[1].png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 6 of 11
(3,787 Views)

Hi jcarmody,

where did you get this library? I just downloaded my version from http://lavag.org/files/file/169-openg-array-xnodes/ but i have different in/outputs of the vis...

Thx

0 Kudos
Message 7 of 11
(3,741 Views)

here my (not so flexible) solution using conditional indexing ...

I canceled my first try , so I thought I should provide at least another solution 😉

createcluster.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 8 of 11
(3,738 Views)

Install the OpenG Package with the help of the VI Package Manager.

 

Regards, Jens

Kudos are welcome...
Message 9 of 11
(3,735 Views)

labview.png  vipm.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 10 of 11
(3,731 Views)