- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have an array e.g. A(3:7,4:8). So index starts from 3 / 4 and ends with 7 / 8. I would like to change it to A(43:47,44:48) without creating a new array and copying it. Is that possible? The array could be dynamically allocated ones. The values in the array will be changed so it doesn't matter if they are the same or not.
Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program arrayindex implicit none real, target :: rawA(5,5) real, pointer :: A(:,:) integer :: r,c do r=1,5 do c=1,5 rawA(c,r) = c*10+r end do end do A(3:7,4:8) => rawA print *, A A(43:47,44:48) => rawA print *,A end program arrayindex
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim for the solution!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page