How to write table to csv without date formatting
1 回表示 (過去 30 日間)
古いコメントを表示
I have a cell c and an array nums, which are used to create a table T. The table is then written to a csv file test.csv.
c = {'6 - 7'; '6 - 8'; '6 - 9'; '6 - 10'; '6 - 11'; '6 - 12'; '6 - 13';
'7 - 8'; '7 - 9'; '7 - 10'; '7 - 11'; '7 - 12'; '7 - 13'; '8 - 9'; '8 - 10'; '8 - 11';
'8 - 12'; '8 - 13'; '9 - 10'; '9 - 11'; '9 - 12'; '9 - 13'; '10 - 11'; '10 - 12';
'10 - 13'; '11 - 12'; '11 - 13'; '12 - 13'};
nums = (1:length(c))';
T = table(c, nums);
writetable(T, 'test.csv');
When I write the table to a csv file and open it in Excel, the entries in c are displayed as a date (ie '6 - 7' is displayed as '7-June' in Excel). I want the entries to appear exactly as the characters that are in d. Is this an issue with MATLAB or is this on the Excel side?
0 件のコメント
回答 (1 件)
Walter Roberson
2018 年 1 月 10 日
It is on the excel side. You can look at test.csv in any convenient text editor. On my system it shows up as
c,nums
6 - 7,1
6 - 8,2
6 - 9,3
6 - 10,4
6 - 11,5
6 - 12,6
6 - 13,7
7 - 8,8
7 - 9,9
7 - 10,10
7 - 11,11
7 - 12,12
7 - 13,13
8 - 9,14
8 - 10,15
8 - 11,16
8 - 12,17
8 - 13,18
9 - 10,19
9 - 11,20
9 - 12,21
9 - 13,22
10 - 11,23
10 - 12,24
10 - 13,25
11 - 12,26
11 - 13,27
12 - 13,28
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!