LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lab View Help (arrays)

Solved!
Go to solution

Thank you for the responses. I tried to implement what you have but I cannot figure it out. Also, I don't understand how the grading is being done and the conditions which were set. If possible would would be able to share the VI. Thank you.

0 Kudos
Message 11 of 23
(1,074 Views)

@AmanAman wrote:

Thank you for the responses. I tried to implement what you have but I cannot figure it out..


Show us how far you got.

0 Kudos
Message 12 of 23
(1,070 Views)

Here is the altered VI. I don't know know how to add different kinds of controls to the bundle function which is what I was stuck on. Like country, # and grade. Also if you could explain the grading process that would be very helpful. Also I tried my best to implement what you have but I'm not sure if its wired correctly. It took me a long time to figure it out what I have now.

0 Kudos
Message 13 of 23
(1,064 Views)
  • You keep attaching VIs in LabVIEW 2021 that you know I cannot open. If you make it too hard for me, I will walk away.
  • If you divide the score by 50 and coerce the result to 0..2, you get three possible number 0,1, or 2. You can use that to index into a string array of A, B, or C as apparently required. if the value is 0, you get the first element (A), and so on. You might need to tweak things a little bit to get the transitions exactly right, but that can be done last.
  • That type cluster is just so I can use "bundle by name" for clarity. You don't need it if you use a plain bundle function. Same result. (You can create a type cluster by placing an empty cluster container constant on the diagram, then create the three diagram constants of the right datatype, eachwith the desired label, then drag them into the container in the desired cluster order. These are all very basic skills that you should have learner by now.)
Message 14 of 23
(1,048 Views)

AmanAman,

 

To make it easier on yourself (and others), use the Save to Previous (under the File Menu) feature. Version 18 should be sufficient unless others chime in. Name it differently and attach.

 

Eric1977_0-1638981662130.png

 

Eric1977_1-1638981681193.png

 

Message 15 of 23
(1,034 Views)

Thank you for your help. I really appreciate it. Sorry I uploaded a file you could not open, this was my first time using these forums I did not realize. I got the grading to work all thanks to your help and the explanation you provided. I ran into a problem because 224/50 is greater than 2 but I was able to tweak it to work properly based on just adding a C grade to anything greater than 2.

 

Also, since you're very knowledgeable on lab view and I already have your attention. I've been struggling on how to rank the countries based upon the least emissions in your code it would be the #/persons value. In the sense of giving the least emissions 1, second least 2, etc. Also, which version of lab view would you like me to save and upload for you in the future? version 18? or screenshots?

0 Kudos
Message 16 of 23
(1,009 Views)

@AmanAman wrote:

I ran into a problem because 224/50 is greater than 2 but I was able to tweak it to work properly based on just adding a C grade to anything greater than 2.


That's why I coerce that value to between 0 and 2! (most often any little piece of my code has a good reason to be there!)

 


@AmanAman wrote:

 I've been struggling on how to rank the countries based upon the least emissions in your code it would be the #/persons value. In the sense of giving the least emissions 1, second least 2, etc.


What do you mean by "rank"? Sort them by that value? Add another element to the cluster that indicates rank? Seems easy. What have you tried?

 


@AmanAman wrote:

Also, since you're very knowledgeable on lab view and I already have your attention.


You can make a big step in your LabVIEW skills by just learning how to spell it! No, it is not "lab view"! Lettercase is important, otherwise it could just be a picture of the view of a lab). Know the difference!

 

altenbach_0-1639005037834.png

 

 

(I can do version 2020 or anything lower)

 

 

0 Kudos
Message 17 of 23
(1,004 Views)

Thank you for the response. To clarify "Add another element to the cluster that indicates rank" is exactly what I meant. I haven't been able to physically write any code because I am brainstorming on how to approach this and haven't came out with a way to do it. Some of the ways I thought about doing it was to use the same grading methodology, however, that would result in multiple countries being ranked the same. Another way I thought about it was to do a series of booleans to compare the individual values, however, this seems very inefficient and probably not possible. If you could steer me in a general direction I can see if I get it figured out.

0 Kudos
Message 18 of 23
(998 Views)
Solution
Accepted by topic author AmanAman

All you really need to know is that in LabVIEW, sorting arrays of clusters will sort hierarchically by cluster order.

 

So here's how that could look like. Make sure you fully understand it:

 

altenbach_0-1639007046492.png

 

Message 19 of 23
(993 Views)

Hello, altenbach. I am not familiar with the function you used in the 2nd for loop. I recognize that the index array notation, but I am at a loss as to how to get my block diagram to look like yours. I've gone through the functions palette and was not able to find it. I would appreciate any guidance you could give me! 

0 Kudos
Message 20 of 23
(942 Views)