Prev: Creating new variables in a loop
Next: I want use imcrop as below, thank you for help very much!
From: Stefan Heinen on 15 May 2010 17:34 Hello, Thus anybody know a command for finding a string containing unknowns. I know there is something for dir like: txtfiles = dir([workdir '\*t?.txt']) '*' means anything and '?' one character. But I like to find a string like M??T with after the M any number, between 01 and 99. So I tried findstr(OAbinM01T.dat,'M??T') but it didn't work. Any one any suggestions. Thx, Stefan
From: us on 15 May 2010 17:51 "Stefan Heinen" <s.g.h.heinen(a)live.com> wrote in message <hsn40c$ds$1(a)fred.mathworks.com>... > Hello, > > Thus anybody know a command for finding a string containing unknowns. > I know there is something for dir like: > > txtfiles = dir([workdir '\*t?.txt']) > > '*' means anything and '?' one character. > But I like to find a string like > > M??T with after the M any number, between 01 and 99. So I tried > > findstr(OAbinM01T.dat,'M??T') > > but it didn't work. > Any one any suggestions. > > Thx, > > Stefan one of the solutions d=dir; d={d.name}.'; r=regexp(d,'.*\.txt$','match'); r=[r{:}].'; disp(r); us
From: Stefan Heinen on 15 May 2010 18:05 "us " <us(a)neurol.unizh.ch> wrote in message <hsn509$gqa$1(a)fred.mathworks.com>... > "Stefan Heinen" <s.g.h.heinen(a)live.com> wrote in message <hsn40c$ds$1(a)fred.mathworks.com>... > > Hello, > > > > Thus anybody know a command for finding a string containing unknowns. > > I know there is something for dir like: > > > > txtfiles = dir([workdir '\*t?.txt']) > > > > '*' means anything and '?' one character. > > But I like to find a string like > > > > M??T with after the M any number, between 01 and 99. So I tried > > > > findstr(OAbinM01T.dat,'M??T') > > > > but it didn't work. > > Any one any suggestions. > > > > Thx, > > > > Stefan > > one of the solutions > > d=dir; > d={d.name}.'; > r=regexp(d,'.*\.txt$','match'); > r=[r{:}].'; > disp(r); > > us The problem is finding a match in strings with unknowns. Not in dir. That thus work. But not something like findstr(OAbinM01T.dat,'M??T') Thanks anyone for having a look on my threath
From: us on 15 May 2010 18:14 "Stefan Heinen" <s.g.h.heinen(a)live.com> wrote in message <hsn5qm$i2i$1(a)fred.mathworks.com>... > "us " <us(a)neurol.unizh.ch> wrote in message <hsn509$gqa$1(a)fred.mathworks.com>... > > "Stefan Heinen" <s.g.h.heinen(a)live.com> wrote in message <hsn40c$ds$1(a)fred.mathworks.com>... > > > Hello, > > > > > > Thus anybody know a command for finding a string containing unknowns. > > > I know there is something for dir like: > > > > > > txtfiles = dir([workdir '\*t?.txt']) > > > > > > '*' means anything and '?' one character. > > > But I like to find a string like > > > > > > M??T with after the M any number, between 01 and 99. So I tried > > > > > > findstr(OAbinM01T.dat,'M??T') > > > > > > but it didn't work. > > > Any one any suggestions. > > > > > > Thx, > > > > > > Stefan > > > > one of the solutions > > > > d=dir; > > d={d.name}.'; > > r=regexp(d,'.*\.txt$','match'); > > r=[r{:}].'; > > disp(r); > > > > us > > The problem is finding a match in strings with unknowns. Not in dir. That thus work. > But not something like findstr(OAbinM01T.dat,'M??T') > Thanks anyone for having a look on my threath well... changing the story(?!)... one of the solutions help regexp; % then s='OAbinM01T.dat'; rex='M??T'; r=regexp(s,rex) % r = 9 us
From: Stefan Heinen on 15 May 2010 18:45 Thx, the command regexp thus really help! Didn't know it jet, but very usefull!. Really thx for the help
|
Next
|
Last
Pages: 1 2 Prev: Creating new variables in a loop Next: I want use imcrop as below, thank you for help very much! |