Re: Reading ASCII data from multiple files into one array? [message #49554] |
Thu, 03 August 2006 09:58 |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
nslods wrote:
> I'm still fairly new to this group, but I have a question that's been
> troubling me for some time now. I have several data files that are all
> in ASCII format. I have no problems reading an individual ASCII file,
> but, if it's at all possible, I'd like to read data from all files into
> a 3d array.
>
> For example:
>
> File 1 contains a=[0,3,8,9,10]
> b=[2,4,6,10,20]
> File 2 contains a=[13,8,6,7,2]
> b=[1,2,3,4,5]
>
> I've been trying FOR loops and such to read the data into a 3d array,
> say, for this example, with dimensions [5,2,2] where the 3rd value
> would be the amount of files I'm opening. Am I going about this in a
> somewhat correct manner, or is my logic completely off?
>
> Thanks in advance for any help.
>
> Nicole
>
You don't tell exactly how you are trying to do it, but this article:
http://www.dfanning.com/tips/read_subscripted_array.html
tells you how to circumvent a common trap which might be your problem.
Good luck,
Benjamin
|
|
|