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

Home » Public Forums » archive » Re: findgen([variable])
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: findgen([variable]) [message #22900 is a reply to message #22899] Tue, 12 December 2000 09:45 Go to previous messageGo to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
I am afraid FINDGEN can not take a vector for dimensions. What I would
try is either using a vector

x = [5, 7]
r = findgen(total(x))

which still would allow transparent indexing of R. If I really needed
multi D arrays, I'd use EXECUTE and build a command string using
dimensions of X:

x = [5, 7]
com = 'r = findgen('
for i =0, n_elements(x)-1 do com = com +'x['+string(i)+']'+ $
string(44b*byte(i ne n_elements(x)-1) > 41b)
i=execute(com)

EXECUTE is not cute, but I can't come up with anything nicer. I need
another cup of coffe :-(

Cheers,
Pavel

Martin Skou Andersen wrote:
>
> Hi...
> I was wondering if I could use findgen with a variable.
> If I in one situation would use a one dimension array and in another
> situation a mutiple dimension array how would i do?
> I have tried with findgen(x), where x could be an integer or an array.
> But when x is an array IDL gives me following error message:
> IDL> r=fltarr(x)+10
> % FLTARR: Expression must be a scalar in this context: X.
> % Execution halted at: $MAIN$
>
> where x is:
> IDL> print,x
> 5 7
> IDL> help,x
> X INT = Array[2]
> Is it posible to make an mutiple dimensional array by using a variable
> such as findgen(x)?
> --
> Thanx in advance
> Martin Skou Andersen
> E-mail: Skou@fys.ku.dk
> Martin_Skou@mail.tele.dk
> Homepage: http://www.fys.ku.dk/~skou/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL and external app in concurrent mode
Next Topic: Background colors in PNG files?

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

Current Time: Fri Oct 10 23:57:52 PDT 2025

Total time taken to generate the page: 7.68418 seconds