How to only extract part of the folder name?

7 visualizaciones (últimos 30 días)
muhammad choudhry
muhammad choudhry el 14 de En. de 2022
Comentada: Matt J el 15 de En. de 2022
Hi,
I have a folder name: Run 12-27-56.Adaptive PIV.6uqqm6yu
I only want to extract the 12-27-57 (only the nulber part) How would I do that ?
I have like around 26 folfers like that and I want to only extract number part.
Any help would be appreciated. Thanks in advance.

Respuesta aceptada

Matt J
Matt J el 14 de En. de 2022
Editada: Matt J el 14 de En. de 2022
str='Run 12-27-56.Adaptive PIV.6uqqm6yu'
str = 'Run 12-27-56.Adaptive PIV.6uqqm6yu'
d2=digitsPattern(2);
extract(str,d2+"-"+d2+"-"+d2)
ans = 1×1 cell array
{'12-27-56'}
  2 comentarios
muhammad choudhry
muhammad choudhry el 14 de En. de 2022
hi, what document should i look for to learn this?

Iniciar sesión para comentar.

Más respuestas (1)

Voss
Voss el 14 de En. de 2022
Here is one way:
folder_name = 'Run 12-27-56.Adaptive PIV.6uqqm6yu';
folder_number = folder_name(find(folder_name == ' ',1)+1:find(folder_name == '.',1)-1)
folder_number = '12-27-56'

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by