Jump to content
simonch

how to save large datas

Recommended Posts

I want to save the datas more than 20M Bytes. But when run the program,there is a dialog box showing as Not enough memory to complete this operation. The memory size of my pc is 2G. So,how to save large datas? Thanks.The version of lv is 8.6

post-16776-125964534014_thumb.jpg

save large datas.vi

Share this post


Link to post
Share on other sites

I want to save the datas more than 20M Bytes. But when run the program,there is a dialog box showing as Not enough memory to complete this operation. The memory size of my pc is 2G. So,how to save large datas? Thanks.The version of lv is 8.6

post-16776-125964534014_thumb.jpg

Hi Simon

I did the maths and you are definitely trying to save more than 20MB... 400MB in fact

post-10325-125964920608_thumb.png

My question to you is - do you need the entire array in memory? If not stream the data to the disk. Additionally may I suggest a binary file and not ASCII for such a large file? You will save a lot of space (and it will be faster as it does not have to convert binary to ASCII etc...).

E.g.

Binary DBL 3.14159265141592 = 8 bytes

ASCII text 3.14159265141592 = 16 bytes

post-10325-125964891543_thumb.png

There maybe some LabVIEW guru's who can suggest a more optimized approach.

The code worked on my PC - but it took a while!

You may wish to span it when it reaches a certain size as well

Share this post


Link to post
Share on other sites

I want to save the datas more than 20M Bytes. But when run the program,there is a dialog box showing as Not enough memory to complete this operation. The memory size of my pc is 2G. So,how to save large datas? Thanks.The version of lv is 8.6

post-16776-125964534014_thumb.jpg

Any reason to have all the data in memory?

I think the memory crash arises when converting to string, just dump the data to disc as binary (like jgcode showed).

The code worked on my PC - but it took a while!

Probably because the 0 ms timeout.

<br><br>Yes, 450 seconds with wait, 310 without wait.<br><br>I would advise to use TDMS files, using text-based files is asking for problems.

What if you data needs to be openend on a PC with a different decimal sign, what if you start to change the number of channels.

Ton

Share this post


Link to post
Share on other sites

I think the memory crash arises when converting to string

Yes the code originally failed on the string conversion.

Having the array in memory would slow things down I would imagine.

Probably because the 0 ms timeout. I would advise to use TDMS files

Well I ran it without the 0 wait in with respect to that comment.

It always worth adding a zero wait to free up the CPU with While Loops - nothing worse than an unthrottled loop.

As it was quite resource intensive I thought it would be a good idea for the For Loop in this case.

Great to see someone else recommending the TDMS format.

The new TDMS 2.0 format in 2009 has some great improvements (support for scaling properties, streaming directly from DAQmx, faster - bypassing the TDMS and Windows buffer straight to HDD etc..)

We use TDMS (or rather gTDMS) for embedded systems but I believe there is now VxWorks support for TDMS 2.0. :cool:

Share this post


Link to post
Share on other sites

thank you, igcode, Ton. i made a mistake about the size of data.it shoud be 20M points rather than 20MB. i do not need the entire array in memory,i jist want to save the data to the disk.

igcode give a very good solution, thank you very much.Now, i use the NI pxi-5122 to acquire datas and save them to disk.there are two channels.the sample rate is 20MHz,and acquire 20M points,even more. in this case,how to save the datas to disk?

post-16776-125967588745_thumb.jpg

daq and save.vi

Share this post


Link to post
Share on other sites

I found some examples with respect to the comment,but i still don't understand how to implement my use.

Some people said using Queue Operations to implement it.

I think you are still going to have trouble converting the data to a string like that unless you do it using chunking or something similar.

You should be able to use the same example I have posted and stream the data to disk.

Just wire in the SCOPE data to the for loop.

Share this post


Link to post
Share on other sites

I think you are still going to have trouble converting the data to a string like that unless you do it using chunking or something similar.

You should be able to use the same example I have posted and stream the data to disk.

Just wire in the SCOPE data to the for loop.

Thank you. I think fig.1 show what you mean. I'm not sure if the fig.2 is same as the fig.1. If they are same,then in fig.2, when N is 50M,still has the promble. So, i doubt fig.1 has the same promble, because the 2D array will be in the memory.Later i will try to run the program on my NI instruments.

In fig.3, N is 100M, there is no problem.

I'm a beginner, and i think my question is very easy for some gurus. Thanks for your patience to answer my questions.

Thank you, all. Thank you, igcode.

fig.1

post-16776-125975526053_thumb.jpg

fig.2

post-16776-125975530199_thumb.jpg

fig.3

post-16776-125975532525_thumb.jpg

Share this post


Link to post
Share on other sites

Also rember to only use Single Precision SGL, that will half your data size, and is probably good enough.

So if your happy to get: 3.1415927 instead of 3.1415926 SGL should work fine

Cheers,

Mikael

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.