How to import mixed date format into matlab

2 visualizaciones (últimos 30 días)
Abaye Getahun Abebe
Abaye Getahun Abebe el 14 de Abr. de 2018
Respondida: Walter Roberson el 14 de Abr. de 2018
I have the following date columns parts of them: (yyyy mm dd) parts of them: (yyyy mmdd) parts them: (yyyymmdd)
I just want to import into matlab with separate columns of year, month, and days.
please have a look the textfile attached

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Abr. de 2018
fid = fopen('01643000.txt');
datacell = textscan(fid,'%8c%f%f%f%f%f', 'CollectOutput',true);
fclose(fid);
years = str2double(cellstr(datacell{1}(:,1:4)));
months = str2double(cellstr(datacell{1}(:,5:6)));
days = str2double(cellstr(datacell{1}(:,7:8)));
other_data = datacell{2};

Más respuestas (0)

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by