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

Home » Public Forums » archive » Where.. Then Loop IDL help
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Where.. Then Loop IDL help [message #93771] Thu, 13 October 2016 21:39 Go to next message
smnadoum is currently offline  smnadoum
Messages: 24
Registered: June 2016
Junior Member
Hi,

I am new to IDL world, and was wondering if you can help me create a loop.

I need to create an array by replacing all values in 'a' that are greater than 5 by 20.

c= where(a gt 5) then [c] = 20

Is this the correct way to do it?

Thanks
Re: Where.. Then Loop IDL help [message #93772 is a reply to message #93771] Thu, 13 October 2016 22:08 Go to previous messageGo to next message
smnadoum is currently offline  smnadoum
Messages: 24
Registered: June 2016
Junior Member
On Thursday, October 13, 2016 at 9:39:33 PM UTC-7, Cheryl wrote:
> Hi,
>
> I am new to IDL world, and was wondering if you can help me create a loop.
>
> I need to create an array by replacing all values in 'a' that are greater than 5 by 20.
>
> c= where(a gt 5) then [c] = 20
>
> Is this the correct way to do it?
>
> Thanks

I think i found a way to do it

a[where(a gt 5,/null)]=20 is it correct?? How can I create an array for this?
I tried to do :c= a[where(a gt 5,/null)]=20, but I keep getting a syntax error
Re: Where.. Then Loop IDL help [message #93777 is a reply to message #93772] Fri, 14 October 2016 02:25 Go to previous messageGo to next message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 10/14/2016 07:08 AM, Cheryl wrote:
> On Thursday, October 13, 2016 at 9:39:33 PM UTC-7, Cheryl wrote:
>> I am new to IDL world, and was wondering if you can help me create a loop.
>>
>> I need to create an array by replacing all values in 'a' that are greater than 5 by 20.
>>
>> c= where(a gt 5) then [c] = 20
>>
>> Is this the correct way to do it?
>>
>> Thanks
>
> I think i found a way to do it
>
> a[where(a gt 5,/null)]=20 is it correct?? How can I create an array for this?
> I tried to do :c= a[where(a gt 5,/null)]=20, but I keep getting a syntax error
if you want to retain a unchanged, then

b=a
b[where(b gt 5,/null)]=20

otherwise, just

a[where(a gt 5,/null)]=20

if a is already an array, so will b, and a remains an array
Re: Where.. Then Loop IDL help [message #93782 is a reply to message #93777] Fri, 14 October 2016 11:20 Go to previous message
smnadoum is currently offline  smnadoum
Messages: 24
Registered: June 2016
Junior Member
On Friday, October 14, 2016 at 2:25:22 AM UTC-7, Markus Schmassmann wrote:
> On 10/14/2016 07:08 AM, Cheryl wrote:
>> On Thursday, October 13, 2016 at 9:39:33 PM UTC-7, Cheryl wrote:
>>> I am new to IDL world, and was wondering if you can help me create a loop.
>>>
>>> I need to create an array by replacing all values in 'a' that are greater than 5 by 20.
>>>
>>> c= where(a gt 5) then [c] = 20
>>>
>>> Is this the correct way to do it?
>>>
>>> Thanks
>>
>> I think i found a way to do it
>>
>> a[where(a gt 5,/null)]=20 is it correct?? How can I create an array for this?
>> I tried to do :c= a[where(a gt 5,/null)]=20, but I keep getting a syntax error
> if you want to retain a unchanged, then
>
> b=a
> b[where(b gt 5,/null)]=20
>
> otherwise, just
>
> a[where(a gt 5,/null)]=20
>
> if a is already an array, so will b, and a remains an array

Thanks so much.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: coregistering images - help needed
Next Topic: Mac Yosemite X Window Display

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

Current Time: Wed Oct 08 11:37:40 PDT 2025

Total time taken to generate the page: 0.00506 seconds