Adding a number to all the elements

  • Follow


Say I got a matrix of 1x500 elements

all 500 elements are random numbers.

How would I +20 to each element?

ex
[1, 50, 20, 60, 70...]

I wanna add 20
it will look like this

[21, 70, 40, 80, 90...].
0
Reply John 12/10/2010 8:00:14 PM

On 10-12-10 02:00 PM, John Stane wrote:
> Say I got a matrix of 1x500 elements
>
> all 500 elements are random numbers.
>
> How would I +20 to each element?
>
> ex
> [1, 50, 20, 60, 70...]
>
> I wanna add 20
> it will look like this
>
> [21, 70, 40, 80, 90...].

NewMatrix = OldMatrix + 20;

0
Reply Walter 12/10/2010 8:04:54 PM


1 Replies
241 Views

(page loaded in 0.059 seconds)

Similiar Articles:













7/16/2012 8:08:00 PM


Reply: