필터 지우기
필터 지우기

How to xlswrite cell array with both strings and number?

조회 수: 1 (최근 30일)
Supreet Hegde
Supreet Hegde 2015년 7월 30일
댓글: Supreet Hegde 2015년 7월 31일
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?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 30일
편집: Azzi Abdelmalek 2015년 7월 30일
A={'''01:02:03'};
  댓글 수: 5
Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 31일
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)
Supreet Hegde
Supreet Hegde 2015년 7월 31일
This works great! Thanks a lot!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Carl Agnew
Carl Agnew 2015년 7월 30일
Change the cell format in excel to "Text".

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by