From: ade77 on
Hi guys,

I have a date in number form. For example 731204 ( which represents dec 19, 2001).

I want to achieve two things:

1. I want to convert the date number to a form like this dd/mm/year.
so I used, output = datestr(731204,'dd/mm/year');

2. I want to now write an excel file to put the output in column 1.
so I used xlswrite('myfile',output);

However, when I open the excel file 'myfile', I get like 11 columns like this 1 9 / 1 2 / 2 0 0 1 [].

However, I want the whole date 19/12/2001 to be in a single column.

Thanks for any help.
From: someone on
"ade77 " <ade100a(a)gmail.com> wrote in message <havnk1$en7$1(a)fred.mathworks.com>...
> Hi guys,
>
> I have a date in number form. For example 731204 ( which represents dec 19, 2001).
>
> I want to achieve two things:
>
> 1. I want to convert the date number to a form like this dd/mm/year.
> so I used, output = datestr(731204,'dd/mm/year');
>
> 2. I want to now write an excel file to put the output in column 1.
> so I used xlswrite('myfile',output);
>
> However, when I open the excel file 'myfile', I get like 11 columns like this 1 9 / 1 2 / 2 0 0 1 [].
>
> However, I want the whole date 19/12/2001 to be in a single column.
>
> Thanks for any help.

% Try this:
output = datestr(731204,'dd/mm/yyyy');
xlswrite('myfile',{output});

% Note the curley brackets.
% Also, if the are multiple dates, use mat2cell instead.
 | 
Pages: 1
Prev: Repeated Measures with anovan
Next: Mcc