comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Accessing numbered arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Accessing numbered arrays [message #93043 is a reply to message #93042] Thu, 14 April 2016 05:56 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
Traditionally, one would use EXECUTE() for this.

There might be cases where using EXECUTE() would be faster because one doesn't necessarily need to make a copy of the array. For example, if all you need is the maximum of the array then

res = EXECUTE('amax = max(temporary(array' + strtrim(i,2) + '))' )

gets the maximum, and deletes the array without ever having to make a duplicate copy.

But I think for most cases SCOPE_VARFETCH would work just as well. (Also note that EXECUTE() can't be used with the virtual machine, but SCOPE_VARFETCH can).

On Thursday, April 14, 2016 at 7:55:57 AM UTC-4, Richard Morton wrote:
> Hi,
>
> I have a routine (not mine) that creates numbered arrays as output, i.e., array1 , array2, array3, etc.
>
> I would like to access these arrays sequentially within a for loop.
>
> I am currently using:
>
> FOR i=0,n DO temp=scope_varfetch('array'+strtrim(i,2)) .
>
> This does the job but is this an appropriate way to do it? From my reading about scope_varfetch it appears to be designed for accessing variables at different levels of the code. This is not what I doing, so I wondered if there was another method.
>
> If a similar question has been answered before I apologise, I couldn't find anything.
>
> Cheers,
> Richard
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 3d Interpolation
Next Topic: Walter and Lieth climate digram

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:07:11 PDT 2025

Total time taken to generate the page: 0.52135 seconds