```Date: Jul 14, 2013 11:32 PM
Author: Nasser Abbasi
Subject: Re: generate specific random value except some numbers

On 7/14/2013 2:43 AM, Antonio Valentine wrote:>>>> ----------------------------->> A = [1:9 11 12 13:21 23:26 28:40];>> N = length(A);>> num_event = 10;>> arrayfun(@(i) A(randi(N,1)),1:num_event)>> -------------------------------->>>>    9    37     6    34    21    40     3    18     4    39>> Your suggestion is quite straightforward.But note: The above can end up picking the same element fromthe set more than one time. Still by random, but you canend up with the same element selected more than once.If you want to randomly select say m elements from a setwithout the same element selected again, you can try this:------------------------------   A = [1,2,3,5,6,7,11,12,20,21];  %the set   m = 5; %number of elements to pick by random   B = zeros(m,1);  %place to store what was selected   for i = 1:m       k = randi(length(A),1);       B(i) = A(k);       A(k) = []; %remove what was selected so it won't be selected again   end   B-------------------------->May I ask for an option of>> A = [1:40];> B = [10 13 22 27];>> Then I can separate into two vectors where vector B the numbers I want to skip it.>> Is that possible?>sorry, do not understand what is asked here.--Nasser
```