Passing arrays of values and indices to Set in Array


When I’m not sure how a node processes its input, I’ll build a little test tree to find out. For example, if I connected arrays to the Index and Value ports of Set in Array, I wasn’t sure if I would get this:

Result[ Index[i] ] = Value[ Index[i] ]
or this:
Result[ i ] = Value[ Index[i] ]
or this:
Result[ Index[i] ] = Value[ i ]

So, I used Build Array from Constant to build an array with a given size, then, for convenience, I use String to Array to build a Index array and a Value array. Then I connected the output to a Set Value, and Show Values showed me that Given these two arrays, Set in Array does this:

Result[ Index[i] ] = Value[ Index[i] ]

In practice, you’re probably more likely to use an Index array like [0,1,2,…], so you’ll effectively have this:

Result[ i ] = Value[ i ]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s