<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158243</link>
    <title>MATLAB Central Newsreader - modified unique</title>
    <description>Feed for thread: modified unique</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 24 Oct 2007 12:54:46 -0400</pubDate>
      <title>modified unique</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158243#398164</link>
      <author> gopla</author>
      <description>Hi,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I have a array A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9] and want output B&lt;br&gt;
= [1 2 4 7 8 9]&lt;br&gt;
&lt;br&gt;
i.e. select only the unique numbers from the array and discard all&lt;br&gt;
numbers that get repeated in the original array.&lt;br&gt;
&lt;br&gt;
I have tried with 'unique' and then a for loop which 'find' number of&lt;br&gt;
occurrence of a element of the output of unique in the original array.&lt;br&gt;
I want to simplify this and try to remove the for loop.&lt;br&gt;
&lt;br&gt;
With Regards&lt;br&gt;
Gopla</description>
    </item>
    <item>
      <pubDate>Wed, 24 Oct 2007 13:02:24 -0400</pubDate>
      <title>Re: modified unique</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158243#398167</link>
      <author>John D'Errico</author>
      <description>&amp;nbsp;gopla &amp;lt;gopalgajjar@gmail.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;1193230486.076915.167300@z24g2000prh.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;      I have a array A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9] and want output B&lt;br&gt;
&amp;gt; = [1 2 4 7 8 9]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i.e. select only the unique numbers from the array and discard all&lt;br&gt;
&amp;gt; numbers that get repeated in the original array.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have tried with 'unique' and then a for loop which 'find' number of&lt;br&gt;
&amp;gt; occurrence of a element of the output of unique in the original array.&lt;br&gt;
&amp;gt; I want to simplify this and try to remove the for loop.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9];&lt;br&gt;
&lt;br&gt;
[B,count] = consolidator(A);&lt;br&gt;
B(count&amp;gt;1) = [];&lt;br&gt;
&lt;br&gt;
B =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;br&gt;
&lt;br&gt;
Find consolidator on the file exchange. (Beware&lt;br&gt;
the wrapped URL. Copy both lines into your&lt;br&gt;
browser)&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?&lt;/a&gt;&lt;br&gt;
objectId=8354&amp;objectType=file&lt;br&gt;
&lt;br&gt;
HTH,&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Wed, 24 Oct 2007 13:04:49 -0400</pubDate>
      <title>Re: modified unique</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158243#398168</link>
      <author>Nick Denman</author>
      <description>Hi Gopla&lt;br&gt;
&lt;br&gt;
&amp;nbsp;gopla &amp;lt;gopalgajjar@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;1193230486.076915.167300@z24g2000prh.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;      I have a array A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9] and&lt;br&gt;
want output B&lt;br&gt;
&amp;gt; = [1 2 4 7 8 9]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i.e. select only the unique numbers from the array and&lt;br&gt;
discard all&lt;br&gt;
&amp;gt; numbers that get repeated in the original array.&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
You may want to try histc.&lt;br&gt;
&lt;br&gt;
&amp;gt; I have tried with 'unique' and then a for loop which&lt;br&gt;
'find' number of&lt;br&gt;
&amp;gt; occurrence of a element of the output of unique in the&lt;br&gt;
original array.&lt;br&gt;
&amp;gt; I want to simplify this and try to remove the for loop.&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
One possible way&lt;br&gt;
&lt;br&gt;
A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9];&lt;br&gt;
AA = unique(A);&lt;br&gt;
n = histc(A,AA);&lt;br&gt;
AA(n==1);&lt;br&gt;
&lt;br&gt;
&amp;gt; With Regards&lt;br&gt;
&amp;gt; Gopla&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Cheers, Nick</description>
    </item>
    <item>
      <pubDate>Wed, 24 Oct 2007 13:05:45 -0400</pubDate>
      <title>Re: modified unique</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158243#398169</link>
      <author>Lee Newman</author>
      <description>&amp;nbsp;gopla &amp;lt;gopalgajjar@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;1193230486.076915.167300@z24g2000prh.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;      I have a array A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9] and&lt;br&gt;
want output B&lt;br&gt;
&amp;gt; = [1 2 4 7 8 9]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i.e. select only the unique numbers from the array and&lt;br&gt;
discard all&lt;br&gt;
&amp;gt; numbers that get repeated in the original array.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have tried with 'unique' and then a for loop which&lt;br&gt;
'find' number of&lt;br&gt;
&amp;gt; occurrence of a element of the output of unique in the&lt;br&gt;
original array.&lt;br&gt;
&amp;gt; I want to simplify this and try to remove the for loop.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; With Regards&lt;br&gt;
&amp;gt; Gopla&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Here's one approach that uses the tabulate function (see&lt;br&gt;
help in statistics toolbox):&lt;br&gt;
&lt;br&gt;
A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9];&lt;br&gt;
x=tabulate(A);&lt;br&gt;
result=x(x(:,2)==1)'&lt;br&gt;
&lt;br&gt;
I suspect there is lower-level/more concise function that&lt;br&gt;
returns frequency counts that might be better than&lt;br&gt;
tabulate(), but this works. </description>
    </item>
    <item>
      <pubDate>Wed, 24 Oct 2007 13:35:24 -0400</pubDate>
      <title>Re: modified unique</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/158243#398176</link>
      <author>Jean-Marc Gulliet</author>
      <description>gopla wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;      I have a array A = [ 1 2 3 3 4 5 5 5 6 6 7 8 9] and want output B&lt;br&gt;
&amp;gt; = [1 2 4 7 8 9]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i.e. select only the unique numbers from the array and discard all&lt;br&gt;
&amp;gt; numbers that get repeated in the original array.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have tried with 'unique' and then a for loop which 'find' number of&lt;br&gt;
&amp;gt; occurrence of a element of the output of unique in the original array.&lt;br&gt;
&amp;gt; I want to simplify this and try to remove the for loop.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;One possible way is using *union* (operation on sets).&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;gt;&amp;gt; A = [1 2 3 3 4 5 5 5 6 6 7 8 9];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;gt;&amp;gt; union(A,A)&lt;br&gt;
&amp;nbsp;&amp;nbsp;ans =&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1     2     3     4     5     6     7     8     9&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;HTH,&lt;br&gt;
&amp;nbsp;&amp;nbsp;--&lt;br&gt;
&amp;nbsp;&amp;nbsp;Jean-Marc</description>
    </item>
  </channel>
</rss>

