 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
KL
Joined: 16 Nov 2009 Posts: 155
|
Posted: Mon Dec 20, 2010 3:51 pm Post subject: Data Initialization |
|
|
I have the following problem: the statement
DATA (a(i),i= 1,2 )/ 1., 2. /
works well, whereas the statement
DATA (a(1:2) )/ 1., 2. /
fails with the comment:
*** Not enough items after '=' in implied-DO loop
*** Compilation abandoned
Is this correct?
Best regards,
Klaus Lassmann
Code: |
Winapp
Program Test53
Implicit None
Real , Dimension (10) :: a
! Integer :: i
! DATA (a(i),i= 1,2 )/ 1., 2. /
DATA (a(1:2) )/ 1., 2. /
write (*,*) a(1:2)
End Program Test53
|
|
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2621 Location: Sydney
|
Posted: Tue Dec 21, 2010 1:00 am Post subject: |
|
|
The alternatives I have listed appear to work. There is a problem with the extra brackets. I'm not sure why.
Code: |
Program Test53
Implicit None
Real , Dimension (10) :: a
! Integer :: i
! DATA (a(i),i= 1,2 )/ 1., 2. / ! ok
! DATA (a(1:2) )/ 1., 2. / ! extra brackets fail
DATA a(1:2) / 1., 2. / ! ok
! DATA a(1), a(2) / 1., 2. / ! ok
write (*,*) a(1:2)
End Program Test53
|
|
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8255 Location: Salford, UK
|
Posted: Tue Dec 21, 2010 10:09 am Post subject: |
|
|
I guess the answer is that it has the form of an implied DO loop but is incomplete. |
|
Back to top |
|
 |
KL
Joined: 16 Nov 2009 Posts: 155
|
Posted: Tue Dec 21, 2010 11:19 am Post subject: |
|
|
Paul, thank you very much for your quick reply. The solution helps me a lot.
Klaus |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|