Why do I get the error "First argument must be text" when using 'strlength'?
29 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 4 Déc 2023
Réponse apportée : MathWorks Support Team
le 4 Déc 2023
Why do I get the error "First argument must be text" when using 'strlength'?
Réponse acceptée
MathWorks Support Team
le 4 Déc 2023
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!