The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting an Array of Clusters

Active Participant

What is Numeric Value Out following execution of the VI?

 

Sorting an Array of Clusters.png

 

a) 1

b) 2

c) 3

d) 1 or 3

Combined.png

Comments
Knight of NI

D

 

The sort works on the first item in the cluster.  So the cluster order (which we cannot exactly know based on the picture) matters.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

For numeric  : A

For string      : string value (a)

Member

Ans..D

It depends on order of cluster.

Member

Ans = D

at 2nd attempt....went for A intially

Knight of NI

Because if the String Value is the first item in the cluster, then you will get 3 as an answer.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

D.  Depends on the order in the cluster.

Member

Hi Steve,

          Here I did mistake! from 2nd comment.

          Ans - D

          depends on order of cluster

Active Participant

Hi Traitor_Saravanan.  It is a tricky one.  crossrulz summed it up nicely.

Combined.png

Active Participant

Answer: D.  Nice one all. 

 

It would help readability if LabVIEW automatically ordered the elements in the cluster constant (top-down maybe) or actually identified with a little number the order of each element within the Cluster.  This could be expanded to the Front Panel when in edit mode.

Combined.png

Knight of NI

You can use the Autosizing->Arrange Vertically to view the elements in order.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Active Participant

Yep, but I'd prefer something that worked for all.  If I have picked up someone elses code for a review maybe, I don't want to go through and have to check how each cluster constant is configured.

Combined.png

Member

Hi,

I tried the above vi and I got 1 as the answer. 

All says about the order of the cluster. I see the cluster order is already mentioned as 1,2,3 from top down in Steve's VI. Which says the answer should be option A. 

Then can I please know how the answer is D ?Array sort.png

 

Knight of NI

Right-click on your cluster constants and choose to reorder the cluster.  Make the string first in the cluster order and you will get 3 for your answer.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

In this example first element is numeric. so, answer is "A"

Knight of NI

krishnaprasad-kp, you really should read all of the comments.  The cluster order is not necessarily the same as what is seen.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

Hi crossrulz, i got ur point.

But here image is given clearly. so whether i need to consider reorder option!?Smiley Wink 

Knight of NI

No, the image is not clear about CLUSTER ORDER.  There is nothing there to state what the order is.  I can very easily make two VIs that will look identical as the image above and will give you two different results.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Member

yes, i agree. thank you.