フィルターのクリア

Too many input arguments for RMS - sudden issue

2 ビュー (過去 30 日間)
Erik J
Erik J 2022 年 3 月 2 日
コメント済み: Walter Roberson 2023 年 12 月 27 日
Suddenly, code that has long worked no longer does. Part of the code uses the rms function. The error I get is "too many input arguments." I have never gotten this error on this code before.
When I check the rms function by just creating a vector (e.g., x = 1:100; rms(x)) - I get the same error.
Does anyone know what could be going on?
Thank you.
  1 件のコメント
Chunru
Chunru 2022 年 3 月 3 日
try "which rms" to find out if rms has been redefined somewhere. Or "dbstop error" to debug the code.

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

回答 (1 件)

vidyesh
vidyesh 2023 年 12 月 27 日
編集済み: vidyesh 2023 年 12 月 27 日
Hi Erik,
I understand that the 'rms' function is unexpectedly generating an "too many input arguments" error with an input that previously worked without issue. There are several potential causes for this behavior:
1) Variable Name Conflict: There might be a variable named 'rms' in the workspace, which could interfere with the function call. To check for this, you can use the command:
who rms
If a variable named 'rms' exists, rename it before attempting to use the 'rms' function again.
2) Function Overloading: A user-defined function named 'rms' may be present in the workspace and it could be expecting different inputs. To verify that the built-in 'rms' function is being called, use:
which -all rms
This will show you all the functions named 'rms' that MATLAB can find in the search path.
3) Path Issues: It's possible that directory changes have caused a custom function to override the built-in 'rms' function. To restore the MATLAB search path to its default state and clear any custom paths, execute the following commands:
restoredefaultpath
rehash toolboxcache
savepath
For more detailed information, you may refer to this MATLAB Answers page:
Hope this answer helps.
  2 件のコメント
Stephen23
Stephen23 2023 年 12 月 27 日
編集済み: Stephen23 2023 年 12 月 27 日
"Variable Name Conflict" leads to a completely different error message:
rms = pi;
x = 1:100;
rms(x)
Index exceeds the number of array elements. Index must not exceed 1.

rms appears to be both a function and a variable. If this is unintentional, use 'clear rms' to remove the variable 'rms' from the workspace.
Walter Roberson
Walter Roberson 2023 年 12 月 27 日
Unless the replacement variable just happened to be an anonymous function that did not accept inputs...

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by