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

Home » Public Forums » archive » Duplicating an array help
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: Duplicating an array help [message #90843 is a reply to message #90842] Mon, 27 April 2015 08:10 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Monday, April 27, 2015 at 8:41:15 AM UTC-5, rryan%s...@gtempaccount.com wrote:
> On Friday, April 24, 2015 at 7:02:42 PM UTC-4, Joe Llama wrote:
>> I'm not entirely sure how best to phrase what I am trying to do but essentially I am trying to find a function that does something like this (but without the loop):
>>
>> x = findgen(5)
>> y = x
>> for i = 0, 100 do y = [y, x]
>>
>> So I then have an array [0,1,2,3,4,0,1,2,3,4...] 100 times. Is there a way of doing this without the loop?
>>
>> Thanks!
>
> I fully endorse the other answers as better than this. But given what yo wrote, you might also consider the "mod" operator:
>
> x= findgen(500) mod 5
>
> -Russell

You probably really want indgen or lindgen -- taking the modulus of a float isn't a good idea and can cause unwanted results!

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how did I get here?
Next Topic: Can the underlying algorithm used in CONTOUR be accessed somehow?

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

Current Time: Wed Oct 08 15:48:30 PDT 2025

Total time taken to generate the page: 0.00215 seconds