Register to reply

Fortran character array

by Gugga
Tags: array, character, code, fortran, initialize
Share this thread:
Gugga
#1
Jan1-11, 05:18 AM
P: 2
Hello all,

I have some data stored in character*1 array(value,value) apparently the code is in f77, i got the original reading code for the data as a text...
I am working in f90, and to the extend of my knowledge (not much in fortran) I can not declare such 2D array as character? http://www.ibiblio.org/pub/languages...an/ch2-13.html
How can I read this data using f90?
When I tried compiling the code, I declared it like this:

character(1) :: array(value,value)

and I get the error: "array requires initializer"

perhaps I am blind and super easy, but I am stuck and i need this to continue my thesis... thanks!
Phys.Org News Partner Science news on Phys.org
Suddenly, the sun is eerily quiet: Where did the sunspots go?
'Moral victories' might spare you from losing again
Mammoth and mastodon behavior was less roam, more stay at home
Gugga
#2
Jan3-11, 06:22 AM
P: 2
So I figured it out... for future reference, depending on the compiler it is possible that wont accept a parameter declaration if it is in parenthesis... so I had declared like this:

integer(4), parameter :: (value1=4596, value2=1345)
character(1), dimension(value1,value2) :: array

instead it should be

integer(4), parameter :: value1=4596, value2=1345
character(1), dimension(value1,value2) :: array

Cheers.


Register to reply

Related Discussions
Printing 1D array in Fortran as 2D array... Programming & Computer Science 7
Comparing array of data is fortran Engineering, Comp Sci, & Technology Homework 12
Co-Array Fortran Programming & Computer Science 2
Fortran, complex array with rank one Programming & Computer Science 7
Array shuffling in fortran Programming & Computer Science 1