[aplusdev] map a very large text file?

John.Mizel at MorganStanley.com John.Mizel at MorganStanley.com
Mon Feb 11 15:30:53 EST 2002


Sasha.

I wrote this awhile ago.  The default is to create a .m file that is a
character vector.  If you know more about the file format, the other
parameters indicate:

Type of data:
  c-character  (default)
  i-long
  f-double


  d1...d9 - shape of the array (default: d1=file_size/sizeof(data_type))

Thanks,
John



On Mon, 11 Feb 2002, Alexander Skomorokhov wrote:

> John,
> 
> > I've attached a small C program that takes any file and prepends the 
> > header information to make it a vaild .m file.
> 
> Did you write it right now?
> 
> > It is simple to use:
> > 
> >   usage: a.out <fromfile> <tofile> [<c|i|f> d1 ... d9
> > 
> > i.e.
> >   gcc beamOut.c -o beamOut
> >   beamOut yourfile.txt  yourfile.m  # Creates a simple character vector
> IT WORKS!!! That is _EXACTLY_ what I wanted. With use of this utility
> we may feel _real_ advantages of memory mapped files.
> 
> > [<c|i|f> d1 ... d9
> Do I understand right that these keys are about file type?
> May I also transform file with numbers to _numeric_ mapped file?
> 
>  
> > Thanks,
> > John
> Thank YOU, John.
> 
> Regards,
> Sasha.
> 
>  
> > On Mon, 11 Feb 2002, Alexander Skomorokhov wrote:
> > 
> > > Brian,
> > > 
> > > > How about:
> > > > 
> > > > $mode ascii
> > > > 'large.m' beam sys.readmat 'large.txt'
> > > Thanks, but...
> > > 
> > > Do I have all content in the memory at a point:
> > > sys.readmat 'large.txt'
> > > ?
> > > 
> > > Saying very large I ment "more than RAM".
> > > 
> > > Sasha. 
> > > 
> > > 
> > > 
> > 
> > -- 
> >  
> > 
> 

-- 
 




More information about the apluslist mailing list