Extract number on variable name.
조회 수: 1 (최근 30일)
이전 댓글 표시
My variable name is Final_50000_run_1
Is there a way to extract the number 50000 and 1 out.
Thanks.
댓글 수: 2
답변 (2개)
Azzi Abdelmalek
2016년 7월 19일
편집: Azzi Abdelmalek
2016년 7월 19일
s='Final_50000_run_1'
regexp(s,'\d+','match','once')
If you want to extract all the numbers
regexp(s,'\d+','match')
댓글 수: 0
Steven Lord
2016년 7월 19일
Is this a variable name or a file name? If it is a variable name, I recommend you read question 1 in the Programming section of the FAQ for an explanation of why including data in your variable names is discouraged. If it is a file name, see Azzi's answer.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!