필터 지우기
필터 지우기

Is there a path in the string?

조회 수: 2 (최근 30일)
Luca Re
Luca Re 2023년 6월 16일
댓글: Mathieu NOE 2023년 6월 20일
hi,
a: example: f='\report\
b: example =f='c:\root\report\
how can i identify the string with case "a" or with "b"?
in the case 'a' i see a folder..
in case 'b' i see a path with folder
  댓글 수: 5
Luca Re
Luca Re 2023년 6월 19일
it seems too simple
Mathieu NOE
Mathieu NOE 2023년 6월 20일
why something simple could not be used ?

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

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 6월 16일
You can utilize the exist() function.
Assume you are at the c:\root folder, and there is a \report sub-folder
exist('\report','dir') will return 0
exist('c:\root\report','dir') will return 7, since 'c:\root\report' is the full path of a folder.
Please note, exist('report','dir') will also return 7.

카테고리

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