How to only extract part of the folder name?

조회 수: 3 (최근 30일)
muhammad choudhry
muhammad choudhry 2022년 1월 14일
댓글: Matt J 2022년 1월 15일
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.

채택된 답변

Matt J
Matt J 2022년 1월 14일
편집: Matt J 2022년 1월 14일
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
muhammad choudhry
muhammad choudhry 2022년 1월 14일
hi, what document should i look for to learn this?

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

추가 답변 (1개)

Voss
Voss 2022년 1월 14일
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'

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by