05-01-2024 11:00 PM
Hello everyone,
I've got a question that I haven't been able to figure out. I have an array containing 6 numbers, and this figure will remain fixed, it won't change.
As you can see in the attached image, I need it to tell me how many numbers fall within different ranges. For example:
1D Array
Data #1: 202602
Data #2: 87410
Data #3: 94178
Data #4: 42647
Data #5: 202500
Data #6: 338100
Through indicators, it should output this:
Range #1 (201000 - 203000): 2
Range #2 (85000 - 90000): 1
Range #3 (93000 - 97000): 1
Range #4 (40000 - 45000): 1
Range #5 (335000 - 340000): 1
I would greatly appreciate your help with this. Thanks a bunch!
05-02-2024 12:47 AM
Hi Brian,
@brian.alejandro15 wrote:
I would greatly appreciate your help with this. Thanks a bunch!
What have you tried and where are you stuck?
(We don't do homework for free, but will help with specific problems and code improvement.)
05-02-2024 06:07 AM
@GerdW wrote:
(We don't do homework for free, but will help with specific problems and code improvement.)
We also don't do homework "for pay", which is why we often hide behind anonymous "avatars" on the Forum.
Bob Schor
05-05-2024 12:30 PM - edited 05-05-2024 12:32 PM
The first step solving a problem is defining it fully. Your image and description are insufficient for that.
What have you tried and what is your remaining problem?
Attach your VI (containing typical default data for all controls) and show us what you tried. Chances are that we can point you in the right direction. The solution will probably fit on a postage stamp.
05-05-2024 01:27 PM - edited 05-05-2024 01:31 PM
As an excellent learning exercise, try to implement the following code from scratch then try to fully understand every detail, how it works, and the purpose of every single code element. (Your teacher reads these forums too and will recognize plagiarism!). While it only took me a few minutes to make, it might take you half a day, but you'll learn a lot!
Note that there are a few landmines, so make sure to fully understand the various types of tunnels, the meaning of the diamonds on the range check icon, potentially invisible characters in the format string, the use of a fixed-width font for the indicator, and other subtleties.
This will work for any input array size (up to ~2^15) and will even work correctly if the ranges overlap and input numbers can fall in more than one range. If the input array can have more than ~2^15 elements, some datatypes need to change, but which ones and how?? It will work equally well if there are fewer or more different range columns in the 2D array diagram constant. Scalability!