MathScript Node Outputs Cluster of Arrays Instead of a Cluster of Elements

Updated May 3, 2018

Reported In

Software

  • LabVIEW MathScript Module

Issue Details

I need an array of clusters, each cluster containing two numbers, as input for my function. This array of clusters shall be be provided by a MathScript node. My problem is that the node's output is actually an array of clusters where each cluster contains two arrays of numbers instead of two numbers. How can I change this?

Solution

Use an indexing For Loop and array manipulation to extract the first element of each array and then pack them into a new cluster:

Additional Information

The reason behind this behavior is a difference in cluster handling in MathScript and LabVIEW. Element inside a struct/cluster inside an array are always treated as an array itself, see the following example.

This creates the struct/cluster out with two elements, x and y:


After adding this line of code, out get automatically converted. It is not a cluster of elements anymore. Now it is a cluster of two 1D arrays:
     

The same cluster of two 1D arrays can be created by this code:

WAS THIS ARTICLE HELPFUL?

Not Helpful