Add ddmmm to the year column

조회 수: 1 (최근 30일)
Damith
Damith 2015년 12월 23일
댓글: Walter Roberson 2015년 12월 24일
Hi,
I have a matrix "c" has year column and I need to add "31May" in front of each year in the column. So, the resulting array should look like below: (first two rows are shown). Note that years are not always in a sequence.
How can I achieve this in MATLAB.?
Thanks in advance.
31May1966 5261.9
31May1967 6003.5

채택된 답변

Andrei Bobrov
Andrei Bobrov 2015년 12월 23일
out = [arrayfun(@(x)sprintf('31May%d',x),c(:,1),'un',0),num2cell(c(:,2))];
  댓글 수: 4
Damith
Damith 2015년 12월 24일
xlswrite function worked here. But, when I open the file, the 1st column has dd-mmm-yyyy. There is a "-". Is there a way to specify the format of the 1st column?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by