Wednesday, May 16, 2012

How can i display date in a 1 by 1 array when i use datestr?

I use datestr to transfer 732154.873773148 into 26-Jul-2004 20:58:14, but when i ouput it to a .csv file, it will be an 1*20 array..., but what i want is to store it in a 1*1 array, how should i do?



And does there exist easy method to transfer 26-Jul-2004 20:58:14 to 2004/07/26 20:58:14?



Thanks:)



data = csvread('4.csv');
date = data(:, 1);
loc = data(:, 2);
record_num = size(loc, 1);

result = zeros(record_num, 2);
new_date = datestr(date);
csvwrite('4_res.txt', new_date);


what i want is
2004/07/26 20:58:14



but it will be
2,0,0,4,/,0,7,/,2,6, ,2,0,:,5,8,:,1,4





No comments:

Post a Comment