[vtkusers] Simple arithmeticquestion..!

Darshan Pai darshanpai at gmail.com
Wed Dec 1 23:08:28 EST 2010


If you are making a new array after negating from x , why not just have a
condition for negative before making new array ?

Regards

On Wed, Dec 1, 2010 at 2:35 AM, rakesh patil <prakeshofficial at gmail.com>wrote:

> Hello,
>
> I have a single dimension array of say 'n' elements. I need to subtract
> each and every value(from this array) from a scalar value say 'x'.
>
> for example, I have array with values, {2,3,5,2,7,8,3}, and let x=4, then
> the final ouput should me x - arr(i)
>
> i.e. final output shud be, {2,1,-1,2,-3,-4,1}
>
> Then after getting this resultant array, I have to replace all the negative
> values with 0.
>
> Can anyone help me to accomplish this without iterating through the
> array...?
>
> Thanks
>
> Regards
> Rakesh Patil
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101201/9d0ddadc/attachment.htm>


More information about the vtkusers mailing list