This is a bit complicated; I\'d welcome any comments on how to improve the clarity of the question.
Ok, say I have an array:
real, allocatable :: A(:
I think you can do this simply by allocating/deallocating the array
Program test
Implicit none
Real, dimension(:,:,:), allocatable :: A
Integer :: i,N
Write(*,*)"Enter N"; Read(*,*)N
Do i = 1, N
if(Allocated(A)) then
deallocate(A);Allocate(A(i,i,i*i))
else
allocate(A(i,i,i*i))
end if
Write(*,*)Shape(A)
End do
end program test
Compiling the program using gfortran gives:
Enter N
5
1 1 1
2 2 4
3 3 9
4 4 16
5 5 25