|
Post by bobpit on May 5, 2016 9:43:59 GMT
Hi fxshrat
I learned a lot about matrixes from your code.
I see that the core grouping criteria is this command: if( int(val) == i )
However this leads to incorrect results if points with different integer values need to be grouped together. For example 1.99 and 2.01.
Consider this: {{0.85, 0.86, 0.89, 0.95, 1.98, 1.99, 2.01, 3.39, 3.4, 3.43, 3.46, 8.4, 15.2, 22.1, 22.14, 22.4, 22.435}}
rows: 1, columns: 17
{ { 0.85, 0.86, 0.89, 0.95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1.98, 1.99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 2.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 3.39, 3.4, 3.43, 3.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 22.1, 22.14, 22.4, 22.435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
The output should be: { { 0.85, 0.86, 0.89, 0.95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1.98, 1.99, 2.01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 3.39, 3.4, 3.43, 3.46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 8.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 22.1, 22.14, 22.4, 22.435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
Anyway, I am not looking for somebody to write the code for me. I asked this in case there is already an easy solution to it.
Thank you very much for the time and effort.
|
|
fxshrat
Private Group
Posts: 566
Received Likes: 211
|
Post by fxshrat on May 6, 2016 9:03:23 GMT
No, no rounding. Why rounding?
You would obviously compare value with previous one(s).
As aside I've found a flaw in my 2nd method if original values are trending within the set threshold being used to compare one value with another. Then those ones will be grouped together in a single row i.e if trending within the set fractional threshold of 0.3 between each value from 0.5, 0.7,... to ..., 9.6, 9.8, 10.1, ...
|
|