1

当我尝试在函数中使用SortAandSortD时:

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

我得到错误Invalid in a function or current expression。我认为这是因为SortA修改变量,这在函数中是不允许的,只能在程序中。有没有办法在函数中以这种方式对列表或矩阵进行排序?

4

1 回答 1

0

您所要做的就是将 b 声明为局部变量(以及 a):

Local a,b

然后它不应该返回您提到的错误。

我希望这有帮助!

于 2021-01-09T17:33:44.240 回答