Borrar filtros
Borrar filtros

How do I Append a Time Stamp?

1 visualización (últimos 30 días)
Matt Brown
Matt Brown el 13 de Feb. de 2017
Respondida: Walter Roberson el 13 de Feb. de 2017
I have a spreadsheet containing a data file that has a time saved with hh:mm:ss in one columun then milliseconds in a second column. Can anyone clue me in on how to combine these to give a time stamp that shows hh:mm:ss:fff after I have read it into Matlab?

Respuestas (1)

Walter Roberson
Walter Roberson el 13 de Feb. de 2017
[~, ~, raw] = xlsread('YourFile.xlsx');
tcol = raw(3:end, 1); %pull out appropriate column
mscol = raw(3:end, 2); %pull out appropriate column
assert(ischar(tcol{1}), 'Expected the time column to be character format');
if ischar(mscol{2}))
mscol = num2cell( str2double(mscol) );
end
mscol_num = cell2mat(mscol);
mscol_char_cell = cellstr( num2str( mscol_num, ':%03d') );
combined = strcat( tcol, mscol_char_cell );

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by