error when using clearvars
조회 수: 4 (최근 30일)
이전 댓글 표시
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
2014년 12월 30일
Alberto - which version of MATLAB are you using? Also, in the command window, type
which strjoin -all
What is returned?
채택된 답변
Geoff Hayes
2014년 12월 30일
Alberto ran the command
which strjoin -all
and noticed that he had a "creepy" strjoin.m file in the path.
댓글 수: 0
추가 답변 (3개)
Chandan Behera
2018년 11월 8일
>> 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.
댓글 수: 0
Image Analyst
2014년 12월 30일
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?
댓글 수: 0
Kim Yano
2017년 10월 31일
Hello, im having the same issue, how i choose the correct strjoin?
댓글 수: 1
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Install Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!