Identifying a file based on character

2 Ansichten (letzte 30 Tage)
Reuben Addison
Reuben Addison am 21 Jan. 2019
Kommentiert: Reuben Addison am 21 Jan. 2019
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 Kommentare
madhan ravi
madhan ravi am 21 Jan. 2019
Bearbeitet: madhan ravi am 21 Jan. 2019
isn't it 10 and 12 ? ah so you want to assign coordinates if the filename contains the substring 'P01'?
Reuben Addison
Reuben Addison am 21 Jan. 2019
Yes please

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kevin Phung
Kevin Phung am 21 Jan. 2019
Bearbeitet: Kevin Phung am 21 Jan. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu Software Development Tools finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by