- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I want to set an Array, that is declared in a module,to a default value. Forone dimensional Arrays I use
real(kind=4) 1Darray(3)
1Darray = [1.,2.,3.]
The only way I know to declare atwo dimensional Array is this:
real(kind=4) 2Darray(3,2)
2Darray(:,1) = [1.,2.,3.]
2Darray(:,2) = [4.,5.,6.]
I would prefer a way like the data statement
data 2Darray /1.,2.,3.,4.,5.,6./
but the data statement wont work, because my variables are declared in a module.
Thanks in advance,
Markus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you need RESHAPE
e.g.
2darray = RESHAPE ((/3, 4, 5, 6, 7, 8, 9, 10/), (/2, 4/))
has the value
[ 3 4 5 6 ]
[ 7 89 10 ].
Les
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you need RESHAPE
e.g.
2darray = RESHAPE ((/3, 4, 5, 6, 7, 8, 9, 10/), (/2, 4/))
has the value
[ 3 4 5 6 ]
[ 7 89 10 ].
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you need RESHAPE
e.g.
2darray = RESHAPE ((/3, 4, 5, 6, 7, 8, 9, 10/), (/2, 4/))
has the value
[ 3 4 5 6 ]
[ 7 89 10 ].
Les
Thanks Les,
reshape did the trick!
Markus

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page