- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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