I'm trying to find min variance (both value and index).

I have x# of product defects tracked over y# of days.

prod1 prod2 prod3...
Day1: 1 1 1
Day2: 1 2 2
I have arrays that store max & min defects, by product#.

minVar = maxDefect[]-minDefect[] gives me the min value. But try as I might, I can't figure out how to deterine the index #. minVar is the value. minVarProd is supposed to be the index.

The output needs to read:

The product with a minimum variance of _x_ is product _y_.
I can get the x but the y is lost on me. Pertinent code follows...

Thank you much in advance!

minVar = maxDefect[p] - minDefect [p];  //Calc & update minVar[]
         minVarProd = p;
6 Years
Discussion Span
Last Post by ChristinaS

You can either loop through each column looking for the day with the minVar for that column, store each minVar in another array, and then search the array of minVar for the desired value when desired, OR you can compare the desired minVar value with the minVar of each column when you do the search for the minVar of each column and print out the desored values as you go.


Thank you very much for all y'all's help! I couldn't have completed this assignment without your help!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.