comp.lang.ada
 help / color / mirror / Atom feed
* unconstrained array type problems
@ 2004-07-21 15:04 zork
  2004-07-21 15:09 ` Ludovic Brenta
  0 siblings, 1 reply; 10+ messages in thread
From: zork @ 2004-07-21 15:04 UTC (permalink / 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





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-07-22  7:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-21 15:04 unconstrained array type problems zork
2004-07-21 15:09 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox