Re: Reference to derived type element by index?
- From: Rob Crain <r.a.crain@xxxxxxxxxxxx>
- Date: Sun, 30 Mar 2008 02:33:16 +0100
Hi - yes, that's what I want to do. If, as you say, this can't be done then a case statement might be the way to go - it's not as elegant as I'd hoped, but this is just a simple routine to parse a parameter file, so it's not mission-critical. Thanks for your help!
Gary Scott wrote:
Rob Crain wrote:.
Hi Gary - thanks for your reply. I think my initial explanation may have been unclear, as this is not the solution to my problem. The problem reduces to the following: I don't know explicitly which variable (I incorrectly referred to this variable as an element previously, hence the confusion) I want to update, so I can't say
circle%radius = <something>
All I have is an index that tells me I need to update the i^th variable within the derived type. So say I need to update circle%z, the index would have value 4. But I know that I can't do
By i'th variable, are you saying the i'th component? No you can't alias an index with the formally defined components and have value 1 refer to radius and value 2 refer to x. You could use select case to make that choice based upon the index. Still not sure I understand fully tho.
<snip>
- References:
- Reference to derived type element by index?
- From: Rob Crain
- Re: Reference to derived type element by index?
- From: Gary Scott
- Re: Reference to derived type element by index?
- From: Rob Crain
- Re: Reference to derived type element by index?
- From: Gary Scott
- Reference to derived type element by index?
- Prev by Date: Re: Press any key to continue?
- Next by Date: Re: what is wrong with this code?can someone walk me through this?
- Previous by thread: Re: Reference to derived type element by index?
- Next by thread: Re: Reference to derived type element by index?
- Index(es):
Relevant Pages
|
|