フィルターのクリア

How to export negative number to a .csv file using writetable()

2 ビュー (過去 30 日間)
Joel Olenga
Joel Olenga 2022 年 7 月 4 日
コメント済み: Joel Olenga 2022 年 7 月 4 日
Hello,
I tried to export a table contaiing a negative value to a .csv file as follows:
C ={'4 -9'}
T = table(C)
writetable(T, 'filename' '.csv')
I'm getting 09-Apr as output because of the negative 9. How can I fix this issue directly in Matlab.
  2 件のコメント
Stephen23
Stephen23 2022 年 7 月 4 日
編集済み: Stephen23 2022 年 7 月 4 日
"I tried to export a table contaiing a negative value to a .csv file as follows:"
But your example shows you exporting some text, no negative numeric values are involved.
C = {'4 -9'};
T = table(C);
writetable(T, 'test.txt')
type test.txt
C 4 -9
"I'm getting 09-Apr as output because of the negative 9."
No, you are getting "09-Apr" because you made the mistake of opening a text file using MS Excel.
"How can I fix this issue directly in Matlab."
How can MATLAB "fix" problems caused by MS Excel's dodgy importing algorithms? (hint: no one can)
Joel Olenga
Joel Olenga 2022 年 7 月 4 日
Thanks!

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

回答 (0 件)

カテゴリ

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