When I try to use SortA and SortD in a function:
Define test()=
Func
© Convoluted way of returning [0 1 2 4 5; 4 1 3 5 2]
Local a,b
a:=[1 5 2 0 4]
b:=[1 2 3 4 5]
SortA a,b
Return colAugment(a,b)
EndFunc
I get the error Invalid in a function or current expression. I think this is because SortA modifies variables and this isn't allowed in a function, only in a program. Is there a way to sort a list or matrix in this way in a function?
All you have to do is declare b as a local variable (as well as a):
And then it shouldn't return the error you mentioned.
I hope that helped!