So for an odd number of rows/columns as i know i have..
my code is as follows
FOR ROWS:
Code:
if ((MAX_ROWS % 2) == 1)
{
MedianIndex1 = ((MAX_ROWS + 1) / 2);
}
for (row = 0; row < MAX_ROWS; row++)
{
RowMedian[row] = SortedRowData[row][MedianIndex1];
/* printf("%f\n",RowMedian[row]); */
}
FOR COLS
Code:
if ((MAX_COLS % 2) == 1)
{
MedianIndex2 = ((MAX_COLS + 1) / 2);
}
for (col = 0; col < MAX_COLS; col++)
{
ColMedian[col] = SortedColData[MedianIndex2][col];
/* printf("%f\n",ColMedian[col]); */
}
When i output these, the ColMedian is perfect!
However when i output the RowMedian the values are wrong. I have established that it is returning the 12th value of the sorted data, rather than the 10th. I am unsure as to why!