Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: find complementary values
Date: Mon, 20 Sep 2010 15:40:05 +0000 (UTC)
Organization: The Mitre Corp
Lines: 33
Message-ID: <i77v8l$546$1@fred.mathworks.com>
References: <i77trk$2ih$1@fred.mathworks.com> <i77ume$q87$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1284997205 5254 172.30.248.37 (20 Sep 2010 15:40:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 20 Sep 2010 15:40:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:671569

"Wayne King" <wmkingty@gmail.com> wrote in message <i77ume$q87$1@fred.mathworks.com>...
> "Norman " <nteferle@gmail.com> wrote in message <i77trk$2ih$1@fred.mathworks.com>...
> > This may be quite simple but I seem to have a brain block. arrgh.
> > 
> > I have a matrix of with numbers in the range between 1 and 100. The matrix does not contain all values between 1 and 100 and for some numbers there might be multiple instances. For example 0, 10, 11, 11, 15, ..., and 89.
> > 
> > Is there a(n) (elegant) way to find those numbers between 1 and 100 that are not represented in the matrix? i.e., 1-9, 12-14, ...,90-100.
> > 
> > Any help is welcome.
> > 
> > Cheers,
> > Norman
> 
> Hi Norman,
> 
> help setdiff
> 
> B = randsample(100,100,true); % requires Statistics Toolbox
> % samples 100 values with replacement from 1:100
> C = setdiff(1:100,B);
> 
> Wayne

% I don't think setdiff works the way you think it does:


>> A = [0, 10, 11, 11, 15, 89];
>> B = 0:100;
>> c = setdiff(A, B)

c =

   Empty matrix: 1-by-0