Wanting to isolate a number from a string
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Stephen Devlin
il 28 Giu 2018
Commentato: Stephen Devlin
il 28 Giu 2018
hi,
I have a struct with a list of filenames which I want to extract a piece of data from, the filename is in the format
ZYXW1_4.0kHz_1_P.tif
or
ZYXW1_26.0kHz_1_P.tif
All I wish to be left with is
4.0_1
or
(4.0,1)
So that I can write those digits onto an image.I have used strep and regex to isolate pieces of data in the past from a string but have not been able to figure out how to isolate data before an expression such as kHz etc.
I have
str=('ZYXW1_4.0kHz_1_P.tif')
expression = '\d*\.\dkHz';
matchStr = regexp(str,expression,'match')
but it won't give me the "_1".
Any ideas?
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!