strsplit causing issues with several functions

9 ビュー (過去 30 日間)
raj6
raj6 2021 年 7 月 13 日
コメント済み: raj6 2021 年 7 月 13 日
I am working on Matlab 2020b and am hoping to use the ros2node function to communicate with a wireless node. But when trying to use this function i get an error because of strsplit
Caused by:
Error using strsplit
Too many input arguments.
A similar error shows up when i try to open the Add-on Explorer and the explorer doesn't open .
I had previous had this error opening the Add-on explorer once before and following instructions of reseting matlab preferences ( using intrcutions provided here https://www.mathworks.com/matlabcentral/answers/99625-how-do-i-regenerate-my-matlab-preferences) solved the problem. These same steps do not work now.
Please help!

採用された回答

Jan
Jan 2021 年 7 月 13 日
編集済み: Jan 2021 年 7 月 13 日
It looks like you have shadowed the builtin function strsplit by a user-defined function, which accepts less inputs.
If you post the complete error message, it would be easier to check, if this assumption is true.
Check this by:
which strsplit -all
What do you get as answer?
To avoid such troubles, do not append folders on the top of the Matlab path, but on the bottom only. Then the user defined strsplit() is shadowed, which can cause bugs also, but it is easier to find them. The solution is to rename the user-defined function.
  1 件のコメント
raj6
raj6 2021 年 7 月 13 日
You are correct. Code I had borrowed from someone else seems to contain a function that is named the same as the builtin function. have removed that function from path and renamed and let the other user know as well.
Thank you for the advice!

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2021 年 7 月 13 日
Let's make sure you haven't created or downloaded a strsplit.m file that's taking precedence over the strsplit function included in MATLAB. What does this display for you?
which -all strsplit
/MATLAB/toolbox/matlab/strfun/strsplit.m
If it displays something outside of toolbox/matlab/strfun that could be the cause of the problem.
  1 件のコメント
raj6
raj6 2021 年 7 月 13 日
You are correct. Code I had borrowed from someone else seems to contain a function that is named the same as the builtin function. have removed that function from path and renamed and let the other user know as well.
Thank you for the advice!

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

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by