findInPath.m

버전 1.0.0.0 (1.64 KB) 작성자: Dan K
Tests paths (or any other string) to find if it contains a substring
다운로드 수: 171
업데이트 날짜: 2014/6/13

라이선스 보기

A simple function to test if a particular set of characters occurs in a string such as a path. I use it because often test data is identified by some set of characters in the path of the data file. It provides a simple (and vectorized) way of checking to see if a particular set of characters is part of the path.
% findInPath - Tests the pathStr input to see if any part of the path contains a test expression
%
% Syntax: tf = findInPath(pathStr,expr,caseSensitive)
% pathStr - string (character array) containing the path to the checked
% expr - Either a string containing a single set of characters to test for or a cell array with each cell containing a
% different string to test for
% caseSensitive - Boolean (optional, defaults to false). If true only an exact match will be accepted
% tf - If a single string is passed in for expr tf will be true/false, If a cell array is passed in for expr then tf
% will be an array with the results for each of the test cases
% Example
% thisPath = 'C:\MATLAB\test\subtest1\AAbbCC'
% tf = findInPath(thisPath,'test') % Results is true
% tf = findInPath(thisPath,'Test') % Result is true
% tf = findInPath(thisPath,'Test',1) % Result is false
% tf = findInPath(thisPath,{'test','Test'}) % Result is [1;1]
% tf = findInPath(thisPath,{'test','Test'},1) % Result is [1;0]

인용 양식

Dan K (2024). findInPath.m (https://www.mathworks.com/matlabcentral/fileexchange/46951-findinpath-m), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Search Path에 대해 자세히 알아보기
도움

줌: findFunctionInPath

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0