How to xlswrite cell array with both strings and number?

I have a cell array of the type A={'01:02:03'};
when I use the function: xlswrite('Output',A)
The excel sheet that I get has eliminated the first zero, it is reading the cell as a number and giving me output as '1:02:03'. How do I get the entire string without eliminating 0?

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 30 de Jul. de 2015
Editada: Azzi Abdelmalek el 30 de Jul. de 2015
A={'''01:02:03'};

5 comentarios

I have cell array of size 2000*15 of such data. What should I do in that case?
Azzi Abdelmalek
Azzi Abdelmalek el 31 de Jul. de 2015
Editada: Azzi Abdelmalek el 31 de Jul. de 2015
Look at this example
s={'01:02:03';'01:02:03';'01:02:03'}
a=strcat('''',s)
xlswrite('fic.xlsx',a)
Sorry Azzi, I forgot to mention that my data has few numbers too. And those numbers are being output as some random symbols. Is there a way out?
s={'01:02:03';11; 20; '01:02:03';'01:02:03' ;11 ;10 }
idx=cellfun(@isstr,s)
s(idx)=strcat('''',s(idx))
xlswrite('fic.xlsx',s)
This works great! Thanks a lot!

Iniciar sesión para comentar.

Más respuestas (1)

Carl Agnew
Carl Agnew el 30 de Jul. de 2015
Change the cell format in excel to "Text".

Preguntada:

el 30 de Jul. de 2015

Comentada:

el 31 de Jul. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by