After updating my mac to Yosemite, everytime I call the function clearvars (e.g.
clearvars x y;
or:
clearvars -except z
)I have the following error:
Error using strjoin (line 14) Expected input to be one of these types:
char
Instead its type was cell.
Error in clearvars>createPattern (line 188) pattern = sprintf('(%s)$', strjoin(variableArgs, '|'));
Error in clearvars (line 70) clearVarPat = createPattern(clearVarArgs, flags.regexpClear);
Any help to solve this issue?

2 件のコメント

Geoff Hayes
Geoff Hayes 2014 年 12 月 30 日
Alberto - which version of MATLAB are you using? Also, in the command window, type
which strjoin -all
What is returned?
Alberto
Alberto 2014 年 12 月 30 日
Your question solved the problem. I had creepy strjoin.m in the path.
Many Thanks!!

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

 採用された回答

Geoff Hayes
Geoff Hayes 2014 年 12 月 30 日

5 投票

Alberto ran the command
which strjoin -all
and noticed that he had a "creepy" strjoin.m file in the path.

その他の回答 (3 件)

Chandan Behera
Chandan Behera 2018 年 11 月 8 日

1 投票

>> which -all strjoin C:\Program Files\MATLAB\R2018a\toolbox\matlab\strfun\strjoin.m
if there are any other strjoin.m then go to setpath in matlab and copy all the matlab folders to the top of the list.
Image Analyst
Image Analyst 2014 年 12 月 30 日

0 投票

Worked fine for me. You can try the function form if you want
clear('x', 'y');
clearvars('-except', 'z')
See if that works. I even tried it with cells and it worked. You don't have any functions called x, y, or z do you? They're variables, right?
Kim Yano
Kim Yano 2017 年 10 月 31 日

0 投票

Hello, im having the same issue, how i choose the correct strjoin?

1 件のコメント

Image Analyst
Image Analyst 2017 年 10 月 31 日
Do
>> which -all strjoin
You should see
>> which -all strjoin
C:\Program Files\MATLAB\R2017b\toolbox\matlab\strfun\strjoin.m
Rename any other strjoin that you may have written so that it has a different name.

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

カテゴリ

ヘルプ センター および File ExchangeInstall Products についてさらに検索

質問済み:

2014 年 12 月 30 日

回答済み:

2018 年 11 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by