The Daily CLAD

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

Re: Sorting an Array of Clusters

SercoSteveB
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

Comments
crossrulz
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.


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
SabariSaravanan.M
Member

For numeric  : A

For string      : string value (a)

ersmt444
Member

Ans..D

It depends on order of cluster.

simonj69
Member

Ans = D

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

crossrulz
Knight of NI

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


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
MrStevenUND
Member

D.  Depends on the order in the cluster.

SabariSaravanan.M
Member

Hi Steve,

          Here I did mistake! from 2nd comment.

          Ans - D

          depends on order of cluster

SercoSteveB
Active Participant

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

SercoSteveB
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.

crossrulz
Knight of NI

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


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
SercoSteveB
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.

VikashKumar23
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

 

crossrulz
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.


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
Krishna_kp
Member

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

crossrulz
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.


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
Krishna_kp
Member

Hi crossrulz, i got ur point.

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

crossrulz
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.


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
Krishna_kp
Member

yes, i agree. thank you.