Showing results for 
Search instead for 
Did you mean: 

case structures and arrays

Go to solution

Student new to Labview. I need some help understanding how to connect an array to a case structure then to a cluster I understand the basics of the array, cluster and case structure just not how to make them play nice with each other. 

 I have an array of 3 test scores which I need to assign a letter grade for each student and then return it to a cluster that displays the letter grade in the cluster. Thanks in advance. I have googled and viewed videos off and on for a week with no results. 


0 Kudos
Message 1 of 5

Your description is insufficient.


So you have an array of 3 scores. Is this one score per student?  How do the scores map to grades?  What do you mean by "return it to a cluster"? What is "it"? (grades, scores, etc.) Where they in a cluster before? What is the data structure of the cluster? Why a cluster?


You probably need to attach a small VI that contains the various data structures and default inputs as well as a description of what outputs you expect.

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 5

this is what I have so far

0 Kudos
Message 3 of 5
Accepted by topic author mfansler28

In the VI you've posted, the idea appears to be to generate one letter (grade) per student, where each student sits 3 exams with weightings 0.3, 0.3 and 0.4 respectively.


Since you want to generate a letter for each student, you should calculate it inside the loop! That way, you won't have any problems with arrays to case structures. Alternatively, you can place it in a separate For loop, with an autoindexing input, but this will probably make it harder to understand the idea in the program.


In terms of producing a cluster, this is also something you probably want to do inside the loop. By storing the "Test Avg" value as the first element, you can use the same Sort 1D Array function to sort the clusters. Be aware that if you don't add some identifier to the individual entries (for example, the 'i' value) you might not be able to work out which student is which once sorted. Perhaps you have name values you can add to the cluster.


Finally, one short point - you can add multiple values using the "Compound Arithmetic" node found on the Numeric (and Boolean) palettes. By default, if you add it from the Numeric palette, the function is Add. You can also subtract by right-clicking a specific entry and choosing "Invert", which will place a small bump on that input.


0 Kudos
Message 4 of 5

Thanks for the input. I implements some of those ideas, and also my instructor got back to me and said I didn't need output clusters just arrays. I misunderstood the assignment. 

0 Kudos
Message 5 of 5