Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: What is the fastest way to threshold data?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85927] Re: [mg85898] What is the fastest way to threshold data?
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Thu, 28 Feb 2008 02:43:52 -0500 (EST)
  • References: <200802270924.EAA16019@smc.vnet.net>

On Feb 27, 2008, at 4:24 AM, Kevin J. McCann wrote:

> I have some 3d data {{x1,y1,z1},{x2,y2,z2},...} and I would like to  
> set
> the z-values to zero if they fall below zero. More generally, I would
> like to set z to a threshold value if it is at or below a threshold.
> This seems as though it should be an easy enough thing to do, but the
> only way I have figured out is to parse out the z-vector, do
>
> mask=((#<thresh&) /@ zdata)/.True->0/.False->1;
>
> then
> zvector = zvector*mask;
>
> and rebuild the {x,y,z} data.

I would apply a function to each point:

If[#3<=thresh,{#1,#2,thresh},{##}]&@@@data

Regards,

Ssezi


  • Prev by Date: Re: How to select terms wanted in a series
  • Next by Date: Question for David Park
  • Previous by thread: What is the fastest way to threshold data?
  • Next by thread: Re: What is the fastest way to threshold data?