help-octave
[Top][All Lists]
Advanced

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

optimize code


From: Jonas Åberg
Subject: optimize code
Date: Mon, 2 Dec 2013 11:28:39 +0000

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

Where different random values are assigned to the different positions of the vector.

 

Of course, the way I wrote it the same random value is assigned to all positions of vector, but I don’t want that…

 

Is this possible?

 

/Jonas

NOTICE: Please immediately e-mail back to sender if you are not the intended recipient. Thereafter delete the e-mail along with any attachments without making copies. The sender reserves all rights of privilege, confidentiality and copyright.

reply via email to

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