who to use string as input?

조회 수: 6 (최근 30일)
Refael
Refael 2013년 4월 27일
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!

채택된 답변

Iman Ansari
Iman Ansari 2013년 4월 27일
Hi. Try this:
function anyFunction(anyString)
length(anyString{1})
end
  댓글 수: 1
Refael
Refael 2013년 4월 27일
it's working
thank u !! :-)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by