I want to obtain an array but this array include more array its inside. I will describe in an example! I want to create 4 matrix. Main matrix is E.
Program array1
!*************************************************!
implicit none
INTEGER, PARAMETER :: m=2 !rows
INTEGER, PARAMETER :: n=2 !cols
Real, DIMENSION(m,n) :: A,D
Real, DIMENSION(1,2) :: B,C
REAL, allocatable,DIMENSION(:,:) :: E
allocate(E(4,4))
! Assign values to the matrix
A(1,:)=(/ 1, 1 /)
A(2,:)=(/ 1, 2/)
B(1,:)=(/ 1, 2/)
C(1,:)=(/ 1, 1 /)
D(1,:)=(/ 1, 1 /)
D(2,:)=(/ 1, 3 /)
!E=(/A, B
! C, D)
! This shape of array
!E=[A B
! C D]
!Result should be as under
!E=[1 1 1 2
! 1 2 0 0
! 1 1 1 1
! 0 0 1 3]
print *,E
End program array1
How can I obtain this array(E) in Fortran? I am working on f90 and f95. I create a new array which is array(E). Important thing obtain E and I can improve after the array because I don't know which case or function I will use for inside an array. If it is matlab, It is easy but for fotran I don't know!
Efrom arraysA,B,C,Dby copying the numbers or do you want them to be somehow part ofE? Do you really require the old Fortran 90? Do you have any code you can share? How areA,B,C,Ddeclared? How shouldEbe declared?