<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265254</link>
    <title>MATLAB Central Newsreader - Histogram</title>
    <description>Feed for thread: Histogram</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>Sat, 07 Nov 2009 18:50:04 -0500</pubDate>
      <title>Histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265254#692916</link>
      <author>Jonas </author>
      <description>Does anybody have a better solution for the code below?  The x- and edge-vectors has a size of 5000 elements in my problem, and the sum of k-vector is equal to the length of the x- and edge-vectors, the code allocates a lot of memory unnecessarily.&lt;br&gt;
&lt;br&gt;
Similar problem &lt;br&gt;
x = (1:1:11)';&lt;br&gt;
u = [2 3.5 4 5 6 5 4 4 3 2 1]';&lt;br&gt;
umin = min(u);&lt;br&gt;
umax = max(u);&lt;br&gt;
edge = linspace(umin,umax,numel(x))';&lt;br&gt;
[k bin]=histc(u,edge);&lt;br&gt;
&lt;br&gt;
u1 = zeros(length(k),max(k));&lt;br&gt;
edge = flipud(edge);&lt;br&gt;
for i=1:length(k)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;u1(i,1:k(i))=edge(i);&lt;br&gt;
end&lt;br&gt;
[m,n] = size(u1);&lt;br&gt;
for i=1:m&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;u2((i*n+1):((i+1)*n)) = u1(i,:);&lt;br&gt;
end&lt;br&gt;
ind1=find(u2==0);&lt;br&gt;
u2(ind1)=[];&lt;br&gt;
subplot(2,1,1); plot(x,u)&lt;br&gt;
subplot(2,1,2); plot(x,u2)</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 09:22:02 -0500</pubDate>
      <title>Re: Histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265254#692972</link>
      <author>Bruno Luong</author>
      <description>Try this:&lt;br&gt;
&lt;br&gt;
x = (1:1:11)';&lt;br&gt;
u = [2 3.5 4 5 6 5 4 4 3 2 1]';&lt;br&gt;
umin = min(u);&lt;br&gt;
umax = max(u);&lt;br&gt;
edge = linspace(umin,umax,numel(x))';&lt;br&gt;
&lt;br&gt;
%&lt;br&gt;
[k bin]=histc(u,edge);&lt;br&gt;
u2=sort(edge(bin),'descend')'&lt;br&gt;
&lt;br&gt;
% Bruno</description>
    </item>
    <item>
      <pubDate>Sun, 08 Nov 2009 09:35:18 -0500</pubDate>
      <title>Re: Histogram</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265254#692973</link>
      <author>Bruno Luong</author>
      <description>sorry I forget to flip the edges&lt;br&gt;
&lt;br&gt;
edge = flipud(edge);&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
  </channel>
</rss>

