Thread Subject: Fastest way to save data?

Subject: Fastest way to save data?

From: Usjes O Cuanachain

Date: 24 Nov, 2009 19:18:05

Message: 1 of 3

Hi,

I am controlling an oscilloscope via Matlab and I use it to capture many samples of data many times. After each capture I transfer the data from the scope directly into a Matlab variable and then I want to save it to my hard disk as fast as possible so that I can collect more data. Currently I am using the save function with the -v6 switch which turns off compression and speeds the save operation up a bit but it is still too slow. Is there any way I can make this operation faster ? Is there some other function I could use ? For reference the data comes from the 'scope in 15MB chunks which is 15e6 samples at 1 byte per sample, when this is assigned to a matlab variable it takes up 120MB (ie. 8 bytes per sample) but the final saved file is only 15MB (even with the -v6 switch) so I guess this 8 byte representation does not slow things down. Is 'save' the best function to use ? Or is there
something that would work quicker ?

Thanks,

Usjes.

Subject: Fastest way to save data?

From: dpb

Date: 25 Nov, 2009 13:38:18

Message: 2 of 3

Usjes O Cuanachain wrote:
> Hi,
>
> I am controlling an oscilloscope via Matlab and I use it to capture
> many samples of data many times. After each capture I transfer the
> data from the scope directly into a Matlab variable and then I want
> to save it to my hard disk as fast as possible so that I can collect
> more data. Currently I am using the save function with the -v6 switch
> which turns off compression and speeds the save operation up a bit
> but it is still too slow. Is there any way I can make this operation
> faster ? Is there some other function I could use ? For reference the
> data comes from the 'scope in 15MB chunks which is 15e6 samples at 1
> byte per sample, when this is assigned to a matlab variable it takes
> up 120MB (ie. 8 bytes per sample) but the final saved file is only
> 15MB (even with the -v6 switch) so I guess this 8 byte representation
> does not slow things down. Is 'save' the best function to use ? Or is
> there something that would work quicker ?
...

Don't know but you might look at

fwrite()

I don't know how much overhead in the save() function you might save;
you'll have to have a file fopen() as well, of course.

Other than that, not much I can think of on the writing itself.

If you're only passing data thru, you might see if it's possible to
somehow bypass the byte-->double-->byte translation as an experiment. I
don't know how you're getting the data or what you're doing w/ it so
that's just a wag for you worth what you paid here in c.s-s.m. for it. :)

--

Subject: Fastest way to save data?

From: Rune Allnor

Date: 25 Nov, 2009 13:53:56

Message: 3 of 3

On 24 Nov, 20:18, "Usjes O Cuanachain" <oisin...@yahoo.co.uk> wrote:
> Hi,
>
> I am controlling an oscilloscope via Matlab and I use it to capture many samples of data many times. After each capture I transfer the data from the scope directly into a Matlab variable and then I want to save it to my hard disk as fast as possible so that I can collect more data. Currently I am using the save function with the -v6 switch which turns off compression and speeds the save operation up a bit but it is still too slow. Is there any way I can make this operation faster ? Is there some other function I could use ? For reference the data comes from the 'scope in 15MB chunks which is 15e6 samples at 1 byte per sample, when this is assigned to a matlab variable it takes up 120MB (ie. 8 bytes per sample) but the final saved file is only 15MB (even with the -v6 switch) so I guess this 8 byte representation does not slow things down. Is 'save' the best function to use ? Or is there
> something that would work quicker ?

Store the data as 1-byte characters, and use FWRITE to
push them to file.

Rune

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com