Printing 1D array in Fortran as 2D array

  • Fortran
  • Thread starter BC2210
  • Start date
  • #1
17
0
Delete..

Delete..
 
Last edited:

Answers and Replies

  • #2
minger
Science Advisor
1,495
2
They're not crazy, if I want to print all row entries in a column, then:
Code:
REAL,DIMENSION(2,3) :: array

DO,i=1,2
  WRITE(6,*) array(i,:)
END DO
You can use the semi-colon as an implicit "all" when operating on arrays.
 
  • #3
Yes. In C, two-dimensional arrays are simply one-dimensional arrayswhose element type is itself a one dimensional array. Since one-dimensional arrays are required to occupy contiguous storage, itfollows that the same must be true for an array of arrays.

Thanks
__________
Techstore are specialists in a range of http://www.techstore.ie/Design-Print/index.html" Services
 
Last edited by a moderator:
  • #4
33,949
5,607
They're not crazy, if I want to print all row entries in a column, then:
Code:
REAL,DIMENSION(2,3) :: array

DO,i=1,2
  WRITE(6,*) array(i,:)
END DO
I don't think you want that first comma after the DO.
You can use the semi-colon as an implicit "all" when operating on arrays.
This character - : - is a colon. This one - ; - is a semicolon.
 
  • #5
minger
Science Advisor
1,495
2
Right-o, as far as the comma, I occasionally get f90 and ANSYS APDL mixed up a bit. Also can't believe I called a, ':', a semi-colon. 1:11pm, perhaps, I was in a lunch daze.
 
  • #6
33,949
5,607


Delete..
BC2210,
Although it's possible for you to delete your own post, it's not a good idea to do so. Other people can possibly learn from your question.
 
  • #7
but why you want to delete the post was it not relevant
 
  • #8
may be it was
 

Related Threads on Printing 1D array in Fortran as 2D array

  • Last Post
Replies
6
Views
6K
Replies
12
Views
14K
  • Last Post
Replies
4
Views
646
Replies
4
Views
12K
  • Last Post
Replies
11
Views
1K
Replies
13
Views
990
  • Last Post
Replies
1
Views
4K
  • Last Post
Replies
3
Views
3K
Replies
4
Views
1K
Top