Is there a Row limit when transfering a matlab table to CSV file?

5 ビュー (過去 30 日間)
Amira Dabchy
Amira Dabchy 2016 年 10 月 7 日
コメント済み: Amira Dabchy 2016 年 10 月 8 日
I have a MATLAB table of 8 columns and 246 312 ROWS. I tried to transfer the MATLAB table to CSV in order to be able to use it in STATA cause I have a MAC and the xlwrite or any other function to transfer to an excel file from MATLAB sends an error mess. So i am using the matlab function:
>> writetable(A, 'filename.csv', 'Delimiter',' ,' ,'QuoteStrings', true).
I get a CSV file with all the 8 columns but only a part of the rows, i get 139 521 instead of the 246 312 rows.
WHY???
How can i get all the rows in?
I tried transferring the CSV file to EXCEl to double check if excel was gonna pick it up, but EXCEL too only gets 139 521.
How can i do to correct that?
PS: My EXCEL version is a MAC version 2011
Thank you for your help.

採用された回答

Walter Roberson
Walter Roberson 2016 年 10 月 8 日
I tested with
A = array2table( randi([0 255], 246312,8,'uint8') );
writetable(A, 'filename.csv', 'Delimiter',',' ,'QuoteStrings', true)
Note that I had to modify the delimiter from ' ,' to ',' alone as writetable only permits a single character for the delimiter (unless a \ escape is used, and even then it has to format into a single character.)
>> !wc filename.csv
246313 246313 7035422 filename.csv
So it got the right number of lines (the extra one is the header)
I opened it with Microsoft Office 2011 on my Mac; all of the lines were there.
  1 件のコメント
Amira Dabchy
Amira Dabchy 2016 年 10 月 8 日
Got it!!! Thank you so much!! It works and I got all the rows

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

その他の回答 (1 件)

Massimo Zanetti
Massimo Zanetti 2016 年 10 月 7 日
Depending on Office version, there are limitations in the maximum number of rows Excel can load. To really know how many rows the CSV file has, open it with another software that does not have limitations. For example: http://www.delimitware.com/
  9 件のコメント
Massimo Zanetti
Massimo Zanetti 2016 年 10 月 8 日
編集済み: Massimo Zanetti 2016 年 10 月 8 日
Yes, you are right. But, as far as Amira says xlswrite didn't work.. That is way I proposed another option (which is indeed the Matlab built-in function to write CSV).
Walter Roberson
Walter Roberson 2016 年 10 月 8 日
xlwrite() from the File Exchange and xlswrite() from MATLAB are not defined in table() data objects.
xlswrite() of a cell containing strings to a .csv file is not supported in Basic mode, which the user would be restricted to because they are on a Mac.
table2cell() followed by xlwrite() from the File Exchange might work. (I do not have the poi_library installed at the moment so I cannot tells at this time.)

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

カテゴリ

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