Add ddmmm to the year column

4 visualizzazioni (ultimi 30 giorni)
Damith
Damith il 23 Dic 2015
Commentato: Walter Roberson il 24 Dic 2015
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

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 23 Dic 2015
out = [arrayfun(@(x)sprintf('31May%d',x),c(:,1),'un',0),num2cell(c(:,2))];
  4 Commenti
Damith
Damith il 24 Dic 2015
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?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by