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

Home » Public Forums » archive » Re: Resizing arrays
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
Re: Resizing arrays [message #45552] Wed, 21 September 2005 12:42
Julio[1] is currently offline  Julio[1]
Messages: 52
Registered: May 2005
Member
Ok, Mike's trick worked out...

Many thanks to all

JĂșlio
Re: Resizing arrays [message #45554 is a reply to message #45552] Wed, 21 September 2005 11:32 Go to previous message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Well, in 2D the equivalent would be to remove rows/columns that are all
zero. TOTAL(ABS()) should do the trick. Haje


"Benjamin Luethi" <luethi@phim.unibe.ch> wrote in message
news:op.sxgpyegso9wlc0@elara...
> Hi,
>
> for a 1D-array that has at least 1 element different from 0:
> nonzero_values = values[where(values ne 0)]
>
> for 2D/3D/...-arrays it's not so simple and you need to give an
> example of what you want to do...
>
> Ben
>
> On Tue, 20 Sep 2005 22:03:34 +0200, Julio <julio@cpa.unicamp.br> wrote:
>
>> Hello,
>>
>> I have a simple question... I have an array, and inside it I have some
>> zero values. I want to resize the array, cutting off the zero values. I
>> want to keep only positive values in the new array.
>>
>> How can I do that... I know it is very simple, but I could not do that.
>> :-(
>>
>> Thanks,
>> Julio
>>
>
>
>
> --
> -------------+
Re: Resizing arrays [message #45556 is a reply to message #45554] Wed, 21 September 2005 10:09 Go to previous message
Benjamin Luethi is currently offline  Benjamin Luethi
Messages: 22
Registered: December 2004
Junior Member
Hi,

for a 1D-array that has at least 1 element different from 0:
nonzero_values = values[where(values ne 0)]

for 2D/3D/...-arrays it's not so simple and you need to give an
example of what you want to do...

Ben

On Tue, 20 Sep 2005 22:03:34 +0200, Julio <julio@cpa.unicamp.br> wrote:

> Hello,
>
> I have a simple question... I have an array, and inside it I have some
> zero values. I want to resize the array, cutting off the zero values. I
> want to keep only positive values in the new array.
>
> How can I do that... I know it is very simple, but I could not do that.
> :-(
>
> Thanks,
> Julio
>



--
-------------+
Re: Resizing arrays [message #45574 is a reply to message #45556] Tue, 20 September 2005 13:29 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> I have a simple question... I have an array, and inside it I have some
> zero values. I want to resize the array, cutting off the zero values. I
> want to keep only positive values in the new array.

IDL> a = [0, 1, 2, 0, 1, 2]
IDL> b = a[where(a gt 0)]
IDL> print, b
1 2 1 2


-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Map Projections with User Defined Ellipsoids (Mars)
Next Topic: Re: Multicolored dashed lines???

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

Current Time: Sat Oct 11 16:24:55 PDT 2025

Total time taken to generate the page: 2.16076 seconds