help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: optimize code


From: Jose
Subject: Re: optimize code
Date: Mon, 2 Dec 2013 15:11:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

Hello Jonas.

On 12/02/2013 01:28 PM, Jonas Åberg wrote:
It is a bit of a newbie problem this, but can this be vectorised?

In principle I need to do

for i=1:10

vector(i)=rand

endfor

I would like to do it by using something that “looks”  somewhat like this

vector(1:10)=rand

Have a look to the documentation of rand. I think what you want is

vector=rand(1,10);

Regards.
J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]