MATLAB Answers

plotting 2gb worth of data

1 ビュー (過去 30 日間)
Maram Alnahhas
Maram Alnahhas 2020 年 7 月 15 日
コメント済み: Maram Alnahhas 2020 年 7 月 16 日
Hi! I have 2gb csv file that I would like to plot (2 columns and around 100,000,000 rows). I read that tall is used for big arrays so I did the following:
s0 = tall(readmatrix('C:\Users\maram\Desktop\test6\RigolDS4.csv'));
x0 = s0(:, 1);
y0 = s0(:, 2);
plot(x0, y0);
I am getting the following error: out of memory, Error in line 1.
I thought of splitting the file, but I couldn't find a software that can open it. FYI, I have 12gb of ram. I would truly appreciate some help. Thanks!

  0 件のコメント

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

回答 (1 件)

Kelly Kearney
Kelly Kearney 2020 年 7 月 15 日
You're trying to show about 10x more data than could possibly be visualized, even on a 4K monitor. Even if you didn't run out of memory, that would be a waste of resources.
The quick and easy solution is to only plot a small subset of the data at once.
plot(x0(1:1000:end),y0(1:1000,end));
Alternatively, if you want to preserve the ability to zoom in on the details while not plotting excessive amounts when zoomed out, there are a few options on the FEX (I like this one) that automatically perform the smart reductions calculations for you. I haven't tried them out with tall arrays, though...

  2 件のコメント

Kelly Kearney
Kelly Kearney 2020 年 7 月 16 日
Although now that I look more closely at your error line number, I don't think you're even getting to the plotting point... the out of memory error comes because of how you're reading in the data. Right now, you're reading the data in in its entirety, then trying to convert it to a tall array. Perhaps try:
s0 = tall(datastore('C:\Users\maram\Desktop\test6\RigolDS4.csv'));
Maram Alnahhas
Maram Alnahhas 2020 年 7 月 16 日
Thanks for the reply. I ran the line you have suggested, but it is still giving me the same error :(

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

Community Treasure Hunt

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

Start Hunting!

Translated by