sortrows "not enough input arguments"

12 ビュー (過去 30 日間)
Michael Diaz
Michael Diaz 2023 年 5 月 27 日
コメント済み: Michael Diaz 2023 年 5 月 27 日
Hello all,
Having difficulty using built-in function sortrows... I am attempting to sort a 2-column double array (var "x" below) by col 1 as follows:
x=sortrows(x,1);
Running this line of code returns the following error:
Error using matlab.internal.math.sortrowsParseInputs
Not enough input arguments.
Error in sortrows (line 60)
Notably, I have attempted running sortrows with matrices and other array types/sizes... all to no avail. Any help much appreciated.
  5 件のコメント
Stephen23
Stephen23 2023 年 5 月 27 日
"I am guessing I shadowed a built-in function somehow?"
Most likely.
"I have a copy of sortrows in my "Current Folder" that is different from the path pasted above"
That would be it.
"I am not sure if this might have anything to do with my current issue."
It is the cause of this issue.
Michael Diaz
Michael Diaz 2023 年 5 月 27 日
Update to all who run into a similar issue in the future -- I did indeed "shadow" the built-in function by having it copied (and possibly edited) into my working directory... deleting the function in my working directory and re-running the code did the trick.
Thanks!

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2023 年 5 月 27 日
x = randi(99, 5, 2)
x = 5×2
15 86 84 4 59 24 61 78 42 33
x=sortrows(x,1)
x = 5×2
15 86 42 33 59 24 61 78 84 4
Seems to work fine. What did you do differently in the 59 prior lines of code?
  1 件のコメント
Michael Diaz
Michael Diaz 2023 年 5 月 27 日
Kindly see above -- I accidentally shadowed the built-in function!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by