POV-Ray : Newsgroups : povray.general : comma separated value file for data input : Re: comma separated value file for data input Server Time
8 May 2024 02:25:01 EDT (-0400)
  Re: comma separated value file for data input  
From: Charles C
Date: 10 Feb 2007 03:25:00
Message: <web.45cd80d8d81812bf7d5894630@news.povray.org>
"Eric" <[firstname]@theothersideofthenet.com> wrote:
> Although far from new to POV-Ray (programmed first rendering in about 1996),
> I am an infrequent user and thus a novice.  Right now I'm returning to it to
> produce some 3D statistical graphs.  It would be really convenient for me
> read data in from some sort of two-dimensional data file (a table).  Comma
> separated value files (.CSV) are commonly used for this.  Is there any
> convenient way to read a CSV file into some sort of data container (an
> array of arrays? or can MATRIX be used other than for transforms?)

Yes, and it's pretty much straight-away what you said, minus the arrays of
arrays.  I don't think you can really do arrays of arrays per se where
lengths or types may vary etc, but you can certainly do multi-dimensional
arrays up to 5D.  Here's a 1D example:

#fopen StatsFile "Stats.csv" read
#local Ctr = 0;
#local Limit = 150; //assuming you know how long it is
#declare StatsArray = array[Limit];
#while(Ctr < Limit)
  #read(StatsFile, StatsArray[Ctr])
  #local Ctr = Ctr + 1;
#end //end while

Or something like that....  I didn't test it for mistakes/typos.  Hope it
helps.
Charles


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.