Why do I get the error "First argument must be text" when using 'strlength'?

조회 수: 29 (최근 30일)
Why do I get the error "First argument must be text" when using 'strlength'?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2023년 12월 4일
This error message can occur when passing an invalid string to 'strlength'. Here are a few examples that produce the error in MATLAB R2023b:
>> str = {num2str(repmat(2,4,1))};
>> strlength(str)
Error using strlength
First argument must be text.
>> strlength({('test')'})
Error using strlength
First argument must be text.
>> strlength(inf)
Error using strlength
First argument must be text.
Note that the input to 'strlength' must be a valid string array, character vector, or cell array of character vectors.
See the 'strlength' documentation for valid examples:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by