Page 1 of 1

Reverse sample

Posted: Thu Jan 05, 2017 5:49 pm
by sinisrus
Hello,

Did you plan to do a function for reverse sample ?

Re: Reverse sample

Posted: Thu Jan 05, 2017 10:25 pm
by airsoftsoftwair
Wouldn't be very difficult to do but I doubt that many people need such a feature. You can do this on your own: Get the sample data using GetSampleData(), reverse the data in the table, and then convert it back into a sample using CreateSample(). Voila. It's just a few lines of code.

Re: Reverse sample

Posted: Thu Jan 05, 2017 11:44 pm
by sinisrus
OK Thank you

Re: Reverse sample

Posted: Sat Jan 07, 2017 10:43 am
by sinisrus
I use :
SORT(Table,Function(a,b) Return(a>b) EndFunction)
for reverse order => The values of the items no longer appear the same

Re: Reverse sample

Posted: Mon Jan 09, 2017 3:40 pm
by sinisrus
Ok i solved:

Code: Select all

Function ReverseItems(T)

    local i, j = 0, ListItems(T)-1

    While i < j
        T[i], T[j] = T[j], T[i]
        i = i + 1
        j = j - 1
    Wend

EndFunction