473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Writing a 2D numeric array to a file

Hi all,

I am trying without much success to understand someone else's VB
program. To make things a little easier to compare side by side, I
wanted to print some of the variables being used within the program to
a file. However, I haven't been able to figure out how to create a
simple output file. I tried inserting the following code just below
the calculations in which I am interested. The code compiles and runs
without error, and my little test message box appears with the correct
pathname, but the file doesn't seem to be created. Can anyone spot
the (probably inanely trivial) error in the code below? GrpData is a
2D numeric array, dbFilepath is a string, all other variables are
declared below.

For the record, I am working with Visual Basic 6.0.

'***** KK *****

'Print GrpData array to file grpadataX.txt, where X is
the group
'index. In this array, the first column represents
the
'simulation data, and the remaining columns hold time
series
'data. All data is stored in one-month increments.

'Declarations

Dim kk As Integer
Dim itime As Integer
Dim iser As Integer
Dim kkfilename As String

'Create file and write data

kkfilename = dbFilepath + "grpdata.txt"
kk = 1
Open kkfilename For Output As #kk
For iser = 0 To NSeries
For itime = 1 To Ntimes
Write #kk, GrpData(iser, itime)
Next
Write #kk,
Next
Close #kk
MsgBox "File should be there now: " + kkfilename

'***** KK *****

Thanks,
Kelly

Jun 21 '07 #1
2 2239
Hi Kelly,

This is not a VB6 or older newsgroup.

Probably in a newsgroup for that they are waiting to help you, one of the
best is

microsoft.public.vb.general.discussions

Cor

"Kelly" <ka*******@gmail.comschreef in bericht
news:11**********************@k79g2000hse.googlegr oups.com...
Hi all,

I am trying without much success to understand someone else's VB
program. To make things a little easier to compare side by side, I
wanted to print some of the variables being used within the program to
a file. However, I haven't been able to figure out how to create a
simple output file. I tried inserting the following code just below
the calculations in which I am interested. The code compiles and runs
without error, and my little test message box appears with the correct
pathname, but the file doesn't seem to be created. Can anyone spot
the (probably inanely trivial) error in the code below? GrpData is a
2D numeric array, dbFilepath is a string, all other variables are
declared below.

For the record, I am working with Visual Basic 6.0.

'***** KK *****

'Print GrpData array to file grpadataX.txt, where X is
the group
'index. In this array, the first column represents
the
'simulation data, and the remaining columns hold time
series
'data. All data is stored in one-month increments.

'Declarations

Dim kk As Integer
Dim itime As Integer
Dim iser As Integer
Dim kkfilename As String

'Create file and write data

kkfilename = dbFilepath + "grpdata.txt"
kk = 1
Open kkfilename For Output As #kk
For iser = 0 To NSeries
For itime = 1 To Ntimes
Write #kk, GrpData(iser, itime)
Next
Write #kk,
Next
Close #kk
MsgBox "File should be there now: " + kkfilename

'***** KK *****

Thanks,
Kelly

Jun 21 '07 #2
Oops, sorry, missed the dotnet part of the name when I did my search.
I'll transfer over.

Thanks,
Kelly

On Jun 21, 5:38 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Hi Kelly,

This is not a VB6 or older newsgroup.

Probably in a newsgroup for that they are waiting to help you, one of the
best is

microsoft.public.vb.general.discussions

Cor

"Kelly" <kakear...@gmail.comschreef in berichtnews:11**********************@k79g2000hse.g ooglegroups.com...
Hi all,
I am trying without much success to understand someone else's VB
program. To make things a little easier to compare side by side, I
wanted to print some of the variables being used within the program to
a file. However, I haven't been able to figure out how to create a
simple output file. I tried inserting the following code just below
the calculations in which I am interested. The code compiles and runs
without error, and my little test message box appears with the correct
pathname, but the file doesn't seem to be created. Can anyone spot
the (probably inanely trivial) error in the code below? GrpData is a
2D numeric array, dbFilepath is a string, all other variables are
declared below.
For the record, I am working with Visual Basic 6.0.
'***** KK *****
'Print GrpData array to file grpadataX.txt, where X is
the group
'index. In this array, the first column represents
the
'simulation data, and the remaining columns hold time
series
'data. All data is stored in one-month increments.
'Declarations
Dim kk As Integer
Dim itime As Integer
Dim iser As Integer
Dim kkfilename As String
'Create file and write data
kkfilename = dbFilepath + "grpdata.txt"
kk = 1
Open kkfilename For Output As #kk
For iser = 0 To NSeries
For itime = 1 To Ntimes
Write #kk, GrpData(iser, itime)
Next
Write #kk,
Next
Close #kk
MsgBox "File should be there now: " + kkfilename
'***** KK *****
Thanks,
Kelly

Jun 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Duncan Smith | last post by:
I am having problems saving arrays to file. e.g. >>> t1 array() >>> t2 array() >>> t3 array() >>> t4 array(,
2
by: Johannes Nix |Johannes.Nix | last post by:
Hi, I have a tricky problem with Numeric. Some time ago, I have generated a huge and complex data structure, and stored it using the cPickle module. Now I want to evaluate it quickly again on a...
5
by: bandw | last post by:
I am having a problem using Numeric-24.0b2 in conjunction with the NetCDF module from ScientificPython (version 2.4.9). This problem does not surface using Numeric-23.8. The problem arises in...
3
by: Trevor.Dhu | last post by:
I am just starting to use python, and as such my question may well be a bit simplistic. I am currently trying to write what should be a very basic set of routines for reading and writing to a...
5
by: Sheldon | last post by:
Hi everyone, I have a short program the writes the output data to an acsii file: import sys import os import string import gisdata from Numeric import *
4
by: Dimitrios Charitatos | last post by:
Hello, I suspect that there is a quite straight forward answer to this, but I can't find it... I want to import an image and extract a matrix (or array) from it with elements showing the RGB...
7
by: Sheldon | last post by:
Hi, I have the following loop that I think can be written to run faster in Numeric. I am currently using Numeric. range_va = main.xsize= 600 main.ysize= 600 #msgva is an (600x600) Numeric...
6
by: Sheldon | last post by:
Hi, I am trying to build a large array using concatenate function in python. So as I loop over the number of arrays, of which there are 12 (4 down and 3 across), I create 3 long arrays by...
4
by: daqmaneng | last post by:
does anyone have any suggestions for writing a two dimensional array of data to a file. Currently, I have an array of 5 columns, with 1000 elements per array. I know that I can use a for next...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.