help-octave
[Top][All Lists]
Advanced

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

RE: Finding values that aren't in an array in octave


From: William Krekeler
Subject: RE: Finding values that aren't in an array in octave
Date: Tue, 11 Oct 2011 13:43:29 +0000

Rick

 

To get values in a2 not in a1 you could also use:                 setxor( a1,a2)

 

This has comparable speed and at least for me is easier to read than a2( ! ismember(a2,a1) ).

 

William Krekeler

 

 

From: address@hidden [mailto:address@hidden On Behalf Of Rick T
Sent: Sunday, October 09, 2011 9:36 AM
To: address@hidden
Subject: Finding values that aren't in an array in octave

 

I have two arrays in octave, a1 is calculated and a2 is given. How can I create a 3rd array a3 that compares a1 to a2 and shows the values that are missing in a1?

 
 
a1=[1,4,5,8,13]

 
a2=[1,2,3,4,5,6,7,8,9,10,11,12,13]

 
a3=[3,6,7,9,10,11,12,13]

 

Also can this work for a floating point number say if a1=[1,4,5,8.6,13] or would I have to convert a1 to integers only.

Thanks

 

--


reply via email to

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