what does a strfind return?

조회 수: 4 (최근 30일)
Cheng Lu
Cheng Lu 2012년 1월 31일
Hi, I am new to Matlab
I am tring to use strfind function to compare a small string with a longer string. I have read the help strfind page, I know it returns either [] empty array or a number (indicate the position the small string matches the longer string). I want to write an if statement after that, something like if the return string is not [] empty or have a value in it. I dont care what value, as long as the return has a value. This is part of my code
for k=1:length(Textdata)
S = strfind(Textdata(k),InputName);
if(S~=null) %this is not right, I dont know how to correct it
FigureIndex=k;
...
end
end
Can someone please give me some help?

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 1월 31일
doc isempty
for the emptiness test
  댓글 수: 1
Cheng Lu
Cheng Lu 2012년 1월 31일
Thanks I think it works

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

추가 답변 (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