strtok return nothing

조회 수: 2 (최근 30일)
Fan
Fan 2011년 9월 7일
Hi, all,
I have a question about strtok.
Run [T,D]=strtok(num2str(5.5),'0.5') return T='' D=''
what's wrong? other number works fine.

채택된 답변

Paulo Silva
Paulo Silva 2011년 9월 7일
There's no 0.5 delimiter on the string, strtok should return T=5.5 but it doesn't, that's weird because it says on the documentation: If no delimiters are found in the body of the input string, then the entire string (excluding any leading delimiting characters) is returned in token, and remain is an empty string ('')
Like this [T,D]=strtok(num2str(5.5),0.5) it works like it says on the documentation.

추가 답변 (1개)

Fan
Fan 2011년 9월 30일
[T,D]=strtok(num2str(5.5),'.5') return T='' D='' have the same problem.

카테고리

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