matlab - printing serial date and data to .csv or excel file using fprintf? -


i started using matlab (r2015a) few weeks ago, , although have searched answer question (and tried few workarounds) haven't had luck. hopefully, it's easy fix!!

i trying write 1 column of serial dates @ high precision (i need milliseconds) , many columns of data .csv file. don't want insane precision everything, first column of dates.

here's i've found: - csvwrite doesn't allow differing precisions.

  • xlswrite doesn't have enough precision (even though serial date double, , yes looked @ spreadsheet cell)

  • dlmwrite appends data in row format, writing dates , appending rest of data doesn't work (though soooo close!)

now i'm trying fprintf:

hz_time serial date (double) data1 , data2 4x25 (double) , 4x7 (double) respectively

hz_time = 1.0e+05 * [7.357583607870371, 7.357583607928241, 7.357583607986110, 7.357583608043980]  str_data = [data1, data2]; filename = (strcat('processed_',files(k1).name)); file = fopen(filename,'w'); fprintf(file,'%.20f\n',hz_time);    fprintf(file,'%f%f%f%f%f%f%f%f%\n',str_data); fclose('all') 

currently, code appends data1 , data2 in 1 cell @ end of str_date_time column. when try concatenating hz_time , data matrices (using strcat) fail:

str_data = strcat([hz_time, data1, data2]) 

warning: out of range or non-integer values truncated during conversion character.

i'm sure it's formatting...

my end goal export data (into .csv or excel spreadsheet or something) first column has serial date (loads of precision) , columns 2-8 have other data in it.

any appreciated.

thanks in advance!


Comments