Identifying a file based on character

조회 수: 1 (최근 30일)
Reuben Addison
Reuben Addison 2019년 1월 21일
댓글: Reuben Addison 2019년 1월 21일
Hello, I designed an experiment and I am preparing to write a script for data analysis, I want to select a file to process based on a condition (i.e. a set of characters in the file name). if the filename(001BL100XP0102.HWR) contains P01 then target cordinate is [24.000;13.000];
Any idea of how to write this code. Thanks in advance, I am still a learner
  댓글 수: 2
madhan ravi
madhan ravi 2019년 1월 21일
편집: madhan ravi 2019년 1월 21일
isn't it 10 and 12 ? ah so you want to assign coordinates if the filename contains the substring 'P01'?
Reuben Addison
Reuben Addison 2019년 1월 21일
Yes please

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

채택된 답변

Kevin Phung
Kevin Phung 2019년 1월 21일
편집: Kevin Phung 2019년 1월 21일
example use of the contains() function:
my_string = '001BL100XP0102.HWR'
if contains(my_string,'P01')
targ_coord = [24.000;13.000];
% insert more elseif conditions here
end
The regexp() function may help you here too. Let me know if this is what you needed or if you need further clarification.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by