MATLAB Answers

Refael

who to use string as input?

Asked by Refael
on 27 Apr 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!

  0 Comments

Products

No products are associated with this question.

1 Answer

Answer by Iman Ansari
on 27 Apr 2013
 Accepted answer

Hi. Try this:

function anyFunction(anyString)
length(anyString{1})
end

  1 Comment

Refael
on 27 Apr 2013

it's working

thank u !! :-)


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today