help-octave
[Top][All Lists]
Advanced

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

Re: Generation of random number which needs to be passed to an array


From: Ganesh Kini
Subject: Re: Generation of random number which needs to be passed to an array
Date: Mon, 15 Jun 2020 22:47:30 +0200

Thank you

I can i iterate all the values without using for loop,

SInce there are many combinations I want to avoid for loop

On Mon, Jun 15, 2020 at 10:44 PM Doug Stewart <doug.dastew@gmail.com> wrote:


On Mon, Jun 15, 2020 at 4:33 PM Ganesh Kini <ganeshrkini19@gmail.com> wrote:
I have 2 variables named A and B

A  has the range from -0.2 to 2.2 
B has the range from  -3.2 to 0.2

I need all the possible to combinations of A and B in 0.1 steps

for example 

A                        B
0.1                  0.2
-0.1               -0.3 and so on 

How do I randomly generate this?

I am not sure what you want, but this might help.

a=-.2:.1:2.2;
b=-3.2:.1:.2;
r1=randi(numel(a))
r2=randi(numel(b))
c=[a(r1) , b(r2)]

--
DASCertificate for 206392


reply via email to

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