I have a csv file with 1.7 million rows and 37 columns. I want to split it into 2 csv files, 850k rows each.Please give me your advice.After the code I wrote, All appear in one column. Where am I doing wrong?

6 件のコメント

Yongjian Feng
Yongjian Feng 2021 年 10 月 28 日
Post your code here please.
Srtm
Srtm 2021 年 10 月 28 日
編集済み: Srtm 2021 年 10 月 28 日
csvwrite('test.csv',input,850000,37)
Rik
Rik 2023 年 1 月 21 日
Why did you remove the image? I have told you before that is considered rude, so now you're doing it knowingly. Is it actually your intention to be an inconsiderate person? Why do you first rely on the kindness of others and then spit in their face?
Srtm
Srtm 2023 年 1 月 21 日
Sorry Rik. I didn't see your previous warning.Can it stay as it is now?
Rik
Rik 2023 年 1 月 21 日
I wrote that when I restored your edits on another thread.
Next time, please think before posting what parts you do not wish to share publicly. Since you published it, I'm still legally allowed to share the original post. Just remember next time that the internet doesn't easily forget.
Srtm
Srtm 2023 年 1 月 21 日
Thank you Rik and sorry again

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

 採用された回答

Cris LaPierre
Cris LaPierre 2021 年 10 月 28 日

1 投票

It looks to me like the issue is that your column offset is 37.
  • The column offset indicates the number of columns to skip before writing the numeric data. col is zero-based, so that col = 0 instructs MATLAB to begin writing in the first column of the destination file. Skipped columns are separated by commas.
By telling it to skip 37 columns, you get 37 commas with nothing between, and it starts writing the 38th column. However, you only have 37 columns of data, so the result is a csv file with nothing but commas. See here.
Try this instead
csvwrite('test.csv',stampstsextport,850000,0)
Also note that csvwrite is not recommended. Consider using writematrix instead.
writematrix(stampstsexport(850000:end,:),'test.csv')
Also note that both of these examples will give you a single file. You would need to have code to create the file of the first 850k rows.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeScripts についてさらに検索

質問済み:

2021 年 10 月 28 日

コメント済み:

2023 年 1 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by