From: "zork" <zork@nospam.com>
Subject: unconstrained array type problems
Date: Thu, 22 Jul 2004 01:04:13 +1000
Date: 2004-07-22T01:04:13+10:00 [thread overview]
Message-ID: <wDvLc.542$pr3.465@roc.nntpserver.com> (raw)
Hi, i am trying to read a matrix from a text file. For instance if i want to
read in a 2 x 3 matrix, my text file is set up as follows:
-----
2
3
1.0
2.4
3.5
1.2
1.1
2.4
....
I was hoping i could do something like the following (I thought an
unconstrained array is the way to go since i do not know the dimensions of
the array until reading the text file):
------------------
procedure Matrix is
type Matrix_Type is array ( Integer range <>, Integer range <> ) of
Float;
..
..
begin
..
Get ( File, number_rows ); -- read the number of rows from file
Get ( File, number_columns ); -- read the number of columns from file
array1 : Matrix_Type ( 1 .. number_rows, 1 .. number_columns );
..
end Matrix;
------------------
I cant seem to define my array1 in the begin / end block. This is a bit
frustrating. How does one get around this? Is an unconstrained array the
best choice?
Any help most appreciated!
thanks,
zork
next reply other threads:[~2004-07-21 15:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-21 15:04 zork [this message]
2004-07-21 15:09 ` unconstrained array type problems Ludovic Brenta
2004-07-21 15:33 ` zork
2004-07-21 15:54 ` Marius Amado Alves
2004-07-21 16:24 ` Ludovic Brenta
2004-07-21 17:33 ` Georg Bauhaus
2004-07-21 17:35 ` zork
2004-07-21 18:30 ` tmoran
2004-07-21 23:11 ` zork
2004-07-22 7:57 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox