who to use string as input?

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!

 Akzeptierte Antwort

Iman Ansari
Iman Ansari am 27 Apr. 2013

0 Stimmen

Hi. Try this:
function anyFunction(anyString)
length(anyString{1})
end

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by