who to use string as input?

2 vues (au cours des 30 derniers jours)
Refael
Refael le 27 Avr 2013
hi everyone
i'm trying to use a string as an input for a function,for example:
function anyFunction(anyString)
length(anyString)
end
the problem is matlb recognise anyString as 1by1 cell and not as 9 char...
thanks!

Réponse acceptée

Iman Ansari
Iman Ansari le 27 Avr 2013
Hi. Try this:
function anyFunction(anyString)
length(anyString{1})
end
  1 commentaire
Refael
Refael le 27 Avr 2013
it's working
thank u !! :-)

Connectez-vous pour commenter.

Plus de réponses (0)

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!

Translated by