필터 지우기
필터 지우기

how can read filename and rename

조회 수: 2 (최근 30일)
SLIMANE BENYAHIA
SLIMANE BENYAHIA 2016년 9월 4일
댓글: SLIMANE BENYAHIA 2016년 9월 5일
file name is : GSM-2_2010060-2010090_0031_EIGEN_G---_005a.gfc
renamed file : 201003.txt
2010 is years
03 is monthe
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 9월 4일
Is the "2010" part to be extracted from the 2010060 or from the 2010090 ? Is the 03 to be extracted from the middle digits of the "0031" ? Or is the "060" and "090" to be understood as day number within year and the second of the two is to be converted to a month number?
SLIMANE BENYAHIA
SLIMANE BENYAHIA 2016년 9월 5일
year is the same, 060 and 090 are days of 365, i want to convert to month( middle of 60 and 90 is 75, 75 of 365 is day of march(03), i have 1386 files like this

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

답변 (2개)

R. B.K.
R. B.K. 2016년 9월 4일
Renaming a File in the Current Folder:
In the current folder, rename oldname.m to newname.m:
movefile('oldname.m','newname.m')
Source: movefile function.

Walter Roberson
Walter Roberson 2016년 9월 5일
Use array indexing to exact the day number strings, and use str2double() to convert to numeric. Average and use as a number of days offset into the year. Convert to month number.
For example,
d = datevec(datenum('2011', 'YYYY') + 75 - 1);
month_number = d(2);
The "- 1" is because datenum() applied to a year will already refer to January 1, day 1 in the year.
  댓글 수: 1
SLIMANE BENYAHIA
SLIMANE BENYAHIA 2016년 9월 5일
thank you Mr. Walter Roberson

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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by