Fastest way to save data?

  • Follow


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. 
0
Reply Usjes 11/24/2009 7:18:05 PM

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. :)

--
0
Reply dpb 11/25/2009 1:38:18 PM


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 har=
d 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 varia=
ble 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
0
Reply Rune 11/25/2009 1:53:56 PM

2 Replies
305 Views

(page loaded in 0.067 seconds)


Reply: