フィルターのクリア

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".
  1 件のコメント
Supreet Hegde
Supreet Hegde 2015 年 7 月 31 日
I have tried doing that. It didn't work.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by