필터 지우기
필터 지우기

how to write a function to return -1 if string is not found in matlab??

조회 수: 3 (최근 30일)
I wrote a function that finds a 3 digit number of a filename? i need to write an if statement to return -1 if this part of the file cannot be extracted ? how do i do that?
Thanks :)
  댓글 수: 2
the cyclist
the cyclist 2016년 9월 5일
There are several possible ways to do this. Can you post your code, or at least the part of it that attempts the extraction?
Image Analyst
Image Analyst 2016년 9월 6일
ANY 3 digit number whatsoever, or only a specific 3 digit number that you specify in the input argument list along with the filename?

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

채택된 답변

the cyclist
the cyclist 2016년 9월 5일
if isempty(w)
w = -1;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by