Hi, when using stats matrix, the reported indices of the maximum and minimum are wrong because the number of columns is falsely reported as y-dimension. Consider the script
$data <<EOD
5 1 5 5
5 5 5 5
5 5 5 5
5 9 5 5
5 5 5 5
EOD
stats 'data.txt' matrix
which reports
Minimum: 1.0000 [ 0 1 ]
Maximum: 9.0000 [ 2 3 ]
The correct indices would be
[ 1 0 ]
[ 1 3 ]
The attached patch fixes this and adds two new variables STATS_size_x and STATS_size_y which contain the matrix dimensions. It further documents the use of stats matrix.
Applied, thanks.
I've marked this as "known bug" in CVS for 4.6 but the patch itself does not apply cleanly to the 4.6 source. If we ever decide to release a 4.6.7 it should include a back-ported version of this fix.