add dd and mmm and time for matrix

6 visualizaciones (últimos 30 días)
Damith
Damith el 22 de Feb. de 2016
Comentada: Star Strider el 24 de Feb. de 2016
Hi,
I have a file like this (see the attached csv file) but I need to include dd mmm yyyy in first column and (arbitrary time say 12:00) time in second column as shown in "output" below. How can I achieve this in MATLAB?
Any help is appreciated.
Thanks in advance.
output:
01 Jan 1990 12:00 203.03
01 Jan 1992 12:00 104.77
01 Jan 1993 12:00 46.156
01 Jan 1994 12:00 150.65
01 Jan 1995 12:00 75.323
.
.

Respuesta aceptada

Star Strider
Star Strider el 22 de Feb. de 2016
You would have to use a cell array:
D = xlsread('Damith 150521.csv');
L = size(D,1);
Dv = [D(:,1) ones(L, 2) ones(L,1)* 12 zeros(L,2)]; % Date Vectors
Out = {datestr(Dv(:,1:6), 'dd mmm yyyy HH:MM') D(:,2)}; % Output Cell Array
celldisp(Out) % Display Output (Can Be Discarded)
  6 comentarios
Damith
Damith el 24 de Feb. de 2016
Thanks.
Star Strider
Star Strider el 24 de Feb. de 2016
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by