From: MOOON MOOON on




Hello,

I have a question regarding random function

assume that we have:

a=[1 2 3 4 5 6 ..... 365]

where a is 1 X 365 matrix

I want to generate a new matrix b which contains

75 % random entries from matrix a

which means that the number of b entries is 274 entries

but these 274 entries will be chosen randomly

using random function

and then, the same method will be used

to generate matrices c and d which contain

50 % and 25 % random entries from matrix a

How can we do this ?

Any help will be appreciated ..

thanks
From: Nathan on
On May 24, 10:08 am, "MOOON MOOON" <shaheed...(a)yahoo.com> wrote:
> Hello,
>
> I have a question regarding random function
>
> assume that we have:
>
> a=[1 2 3 4 5 6 ..... 365]
>
> where a is 1 X 365 matrix
>
> I want to generate a new matrix b which contains
>
> 75 % random entries from matrix a
>
> which means that the number of b entries is 274 entries
>
> but these 274 entries will be chosen randomly
>
> using random function
>
> and then, the same method will be used
>
> to generate matrices c and d which contain
>
> 50 % and 25 % random entries from matrix a
>
> How can we do this ?
>
> Any help will be appreciated ..
>
> thanks

a = [1:365];
b = randperm(length(a));
b = a(b(1:round(.75*length(a))));
c = randperm(length(a));
c = a(c(1:round(.5*length(a))));
d = randperm(length(a));
d = a(d(1:round(.25*length(a))));

-Nathan