12-05-2020 06:14 PM
Hello, I am working on a school project. I have a while loop that and calculates BMI and inserts it in an array 200 times. I need to create 6 categories for BMI, such if (if BMI=0, Catergory = NA, if BMI< 18.5, Catergory= underweight, if BMI>=18.5 && BMI<=24.9, Category = Healthy, etc). How do I do this using case structure? Cannot figure out a way. I have BME categories stored as Enums
Solved! Go to Solution.
12-05-2020 07:34 PM
I believe that you may want to rethink your approach.
Since this is homework I'll only pass in a reading assignment and a hint. You have a monotonic array of thresholds... read the descriptions of the functions on the Array Palette an see if that inspires you.
(And turn off quick drop until you have learned the basic Palette features!.... it's like trying to learn elementary arithmetic by using a calculator!)
12-06-2020 06:44 AM
I'll help you narrow down a little more. Specifically study the Threshold 1D Array.
12-06-2020 10:49 AM - edited 12-06-2020 10:51 AM
@crossrulz wrote:
Specifically study the Threshold 1D Array.
... and then index in an array of strings or wire to your enum. No case structure needed.
12-06-2020 10:59 AM
@taras01 wrote:
Hello, I am working on a school project. I have a while loop that and calculates BMI and inserts it in an array 200 times.
Seem redundant to insert it 200 time unless you have 200 different datasets. If the input is an array of 200 datasets, you'll get an array of 200 results. No need to "insert" anything. Since you know the number of iterations before the loop starts, a FOR loop is more appropriate than a WHILE loop.
What is the raw data? A 2D array where each row contains mass and height to calculate BMI? An 1D array of BMIs? A text file that needs to be parsed?
Typically you will get better help if you would attach a simple VI that contains a typical dataset and your enum, Please do.
12-06-2020 11:18 AM
That is SubVI we need to use. It produces 1D array of cluster of 6 elements for each patient and there are 200 of them.
12-06-2020 11:23 AM
@taras01 wrote:
That is SubVI we need to use.
What is?
So just autoindex on your array, unbundle and process the 6 elements for each subject, then get the array of results at the end.
What are the 6 elements per cluster? Are some of them inputs for the calculation and some results to be updated? Is the cluster a typedef?
12-06-2020 01:40 PM
12-06-2020 01:43 PM
And also, not sure if Threshold 1D array can be used here. I am also trying to use the nested case structures, but not sure how to set the conditions in that setup.
12-06-2020 02:41 PM