MATLAB: Time reading in matlab

datetime

Hi, I have a data set, using matlab I need to read all the data.But the date and time reading is not working.Please help me.

Best Answer

Hi,
Here is the complete solution script. Please note that your data file is renamed (S1932.txt):
File_Name = 'S1932.txt';
Formatting_Spec = '%s%s%s %s%f%s %f%f%f %c %d%d%d';
N_header = 10;
My_FID=fopen(File_Name, 'r');
DATA=textscan(My_FID, Formatting_Spec, 'headerlines', N_header);
fclose(My_FID);
Date = DATA{1}; % You can ignore this

Time = DATA{2}; % You can ignore this
ET = DATA{3}; % You can ignore this
GT = DATA{4};
MAG = DATA{5};
M = DATA{6};
LAT = DATA{7};
LON = DATA{8};
DEPTH= DATA{9};
Q = DATA{10};
EVID = DATA{11};
NPH = DATA{12};
NGRM = DATA{13};
Good luck.