Add ddmmm to the year column
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Andrei Bobrov
2015-12-23
out = [arrayfun(@(x)sprintf('31May%d',x),c(:,1),'un',0),num2cell(c(:,2))];
4 个评论
Walter Roberson
2015-12-24
To check, are you writing a datenum (numeric value) to the column or are you writing a string like '31May1996' to the column?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!