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

Home » Public Forums » archive » Re: replace array's elemets
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: replace array's elemets [message #35188 is a reply to message #35176] Fri, 16 May 2003 09:13 Go to previous messageGo to previous message
Chris[1] is currently offline  Chris[1]
Messages: 23
Registered: January 2003
Junior Member
Hi Roberto;

Use the "where" function - as in

(assume x is your 100x100 array)

w = where(x ne 0, count)
if count gt 0 then x[w] = 1


Cheers;

Chris

"Roberto" <graftons@tiscalinet.it> wrote in message
news:4ac6b3e5.0305160733.50173373@posting.google.com...
> Hi
> I have a 100x100 array.
> How can I replace an element if is different from 0?
> I would replace all elements different from 0 with 1.
> thank and sorry for the trouble.
> Roberto
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: plotting from high values to low values
Next Topic: read pixels

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

Current Time: Wed Oct 08 17:43:19 PDT 2025

Total time taken to generate the page: 0.00394 seconds