help-octave
[Top][All Lists]
Advanced

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

Re: Finding the other elements in array or matrices


From: Søren Hauberg
Subject: Re: Finding the other elements in array or matrices
Date: Wed, 16 Jan 2008 08:24:47 +0100

tir, 15 01 2008 kl. 18:13 -0800, skrev pauljoseph:
> Hi,
> Can someone help me on how to do this effectively in Octave?
> 
> for example I have an array:
> a=[10,20,30,40,50];
> 
> and I have another list
> mask=[1,4];
> 
> if I type
> a(mask)
> 
> , I will get:
> 10, 40
> 
> But what I want to get is the other elements which is 2,3, and 5, which
> gives
> 20,30,50
> 
> And what I have in hand is only a and mask.
> 
> I would appreciate your help :)
You could use 'setdiff':

setdiff(1:5, mask)
ans =
   2   3   5

Søren



reply via email to

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