check the sort() method of arrays. you can create custom sort functions and, in your situation, sort array elements like numbers using a parameter passed to the sort() method:
I have already done that but only works with values that i write directly in the matrix, but not with those from an input field.
Part of script used is as follows:
If I enter de values 3,5,15,7,8 in the appropiate input fields, when I write my.sort(Array.NUMERIC);then result is: 15,3,5,7,8
If I write my=[3,5,15,7,8]; it works correctly.
I d´nt know why
values from textfields are strings (even if it looks like a number to you). there are several ways to handle this and one is to cast that string as a number before you add it to your array: