Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

who to use string as input?

Asked by Refael

Refael (view profile)

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

Refael

Refael (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Iman Ansari

Iman Ansari (view profile)

on 27 Apr 2013
Accepted answer

Hi. Try this:

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

1 Comment

Refael

Refael (view profile)

on 27 Apr 2013

it's working

thank u !! :-)

Iman Ansari

Iman Ansari (view profile)

Contact us