Latest Uploads
Sample Bio ... ph Fractal


Biomorph Fractals




Rpg items


Duck Invaders


Smaller Scar?


Forum Home

File Manipulation

Posted : Monday, 06 December 2010, 03:34 | Permalink

WW Entries : 7

Long time no see. I still lurk occasionally but I haven't posted for a while and I certianly haven't coded for a while. Hence, I am rusty.

Therein lies my dilemna: I have a task I wish to complete, and I believe that a little Blitz program will make this easier.... If only I could properly remember how to program, that is.

Anyway, I'll start off with my first problem. I am trying to read a column of data from a text file. The first line of the column is a text string and the lines beneath are floats. I am trying to commit this data to 2 arrays: 'FirmName$(a)' for the string, and all of the rest of the floats into 'DataSet1#(b)'.

Here if my code so far. Unfortunately, I have got stuck quite early on in the sense that my debug reporting suggests that it can't see any data in the file...


Any help, links, tips would be super cool.

I will no doubt return quickly after this problem is solved with another problem, as my program develops in size and sophistication.

Thanks in advance!

Homepage :
Posted : Monday, 06 December 2010, 03:55 | Permalink

WW Entries : 106
Is the "Float" stored AS a float, or is it a line of text?
(as in, if you open the .dat in notepad, is it readable, or gobbledegook)

If so, ReadTxt$=ReadLine(CorrelData): Read1#=float(ReadTxt$)

"Load, Next List!"
Homepage :
Posted : Monday, 06 December 2010, 08:11 | Permalink

WW Entries : 7
The data in the file is readable. I will upload it for reference.

I managed get the program to output the data as I expect it to; the data is being stored as I want.

However, that means we now have the next step. By the end, the file will have anything up to 100 columns of data. I need to be able to store all that data in arrays (I can't quite remember but can you have arrays such as 'Dim ArrayName(5,5)'?).

When all the data is stored, I hope to be able to calculate the correlation coefficients between each of the columns of data. That is something I will consider more deeply when I get to it; at the moment I am just trying to get all the data into array ready for processing.

What I can't think of how to do, is the parse/read the file of data and get each chunk of data into its appropriate place in the array. that is where I need help. I never was good at file manipulation

Here is the latest code:

Correlation Data File
Note that I had to change the file extension to the less cool .txt in order to upload it.
Homepage :
Posted : Monday, 06 December 2010, 17:57 | Permalink

Here's what it sounds like you want.

Posted : Wednesday, 08 December 2010, 06:19 | Permalink

WW Entries : 7
I have spend the last day and a half working on your code, Andy, and fine tuning it/modifying it to my needs. Your structure has proved invaluable in allowing me to progress, so a big thanks for that.

The latest I have done so far is make it super easy to change the number of firms in the data file without making the program have a wobbly, introduce a correlation coefficient calculator function, and implement it in a manner such that it calculates the coefficients between all the firms in the data file.

Calculating the correlation coefficient between the data from the file is exactly what I wanted - and it works! This makes me happy.

So now that the program is robust enough for my needs, all I need to do now is get data on another 95 firms or so!!

I should be able to make any minor modifications to the program if the need arises, but I'll be back if there is something that stumps me

Many thanks for your help, Jay and Andy. It is most appreciated.
Homepage :
Posted : Wednesday, 08 December 2010, 06:35 | Permalink

WW Entries : 106
Sorry, I completely forget to get back to this topic! Glad you sorta sorted it!

"Load, Next List!"
Homepage :
Posted : Wednesday, 08 December 2010, 08:44 | Permalink

Glad it all worked out for you.

Getting the data into arrays was the toughest part (and it wasn't all that hard).
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 523|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Latest Posts
Rotate a 1bpp image?
Jayenkai Fri 18:53
Jayenkai Fri 17:10
Rhythm Heaven Megamix
Jayenkai Fri 17:04
Kuron Fri 16:11
Siri Where'd I park my car? : BOOM!
Jayenkai Fri 15:04
Don't Stream That Scene
Kuron Fri 15:00
steve_ancell Fri 13:18
Happy Birthday Rychan
rychan Fri 08:55
Nintendo Switch
GfK Fri 05:35
AGameAWeek : 2016 - Part Two
Jayenkai Thu 06:51

Latest Items
Woot : Getting Noticed... for Gameboy Dev!
rychan Fri 08:56
Dev-Diary : 1st Ever Wed Workshop Progress
zzoom Thu 23:12
Showcase : Biomorph Fractals
Andy_A Wed 12:43
Snippet : Fisheye Lens Effect
Jayenkai Wed 11:50
Snippet : 2D Balls
Jayenkai Wed 06:22
Showcase : Mining Map AI Demo
Stealth Tue 19:41
Showcase : Biotic Limit - Games For Better (2 Days) Edition
rychan Mon 12:27
Dev-Diary : Intellivision Controller Adapter
spinal Sun 11:33
Snippet : Contour Map from Data
HoboBen Fri 18:14
Snippet : FPS Control (WASD+Mouse)
Pakz Wed 22:30
Article : Concurrency in C#
Afr0 Sun 12:28
Snippet : Mandelbrot in BMax
Jayenkai Sun 03:37
News : Newsletter #281
HoboBen Fri 04:18
News : Newsletter #280
Jayenkai Sat 05:10
Blog : Monkey-X Box2D: Learning from my perspective... Hopefully!
steve_ancell Sun 14:49

Who's Online
Fri, at 19:44
Fri, at 19:03
Fri, at 17:31
Fri, at 17:20
Fri, at 16:19
Fri, at 15:24
Fri, at 15:04
Fri, at 14:11
Fri, at 11:44
Fri, at 11:28
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.