<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265009</link>
    <title>MATLAB Central Newsreader - hide vectors in quiver plot completely</title>
    <description>Feed for thread: hide vectors in quiver plot completely</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, 04 Nov 2009 20:09:02 -0500</pubDate>
      <title>hide vectors in quiver plot completely</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265009#692180</link>
      <author>Fab Braun</author>
      <description>hi all!&lt;br&gt;
&lt;br&gt;
i'm dealing around with showing the optical flow of an image in a quiver plot.&lt;br&gt;
so far no problem, except I haven't found a solution yet to completely remove zero valued vectors from the quiver plot.&lt;br&gt;
&lt;br&gt;
the following i read somewhere:&lt;br&gt;
Vectors(Vectors == 0) = nan;&lt;br&gt;
&lt;br&gt;
bud this doesn't work 100%...because there is still a small point left everywhere i want to set these vectors to zero.&lt;br&gt;
&lt;br&gt;
any other ideas?&lt;br&gt;
&lt;br&gt;
thanks in advance!&lt;br&gt;
fabian</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 00:29:19 -0500</pubDate>
      <title>Re: hide vectors in quiver plot completely</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265009#692561</link>
      <author>Mohd Kharbat</author>
      <description>Hello Fabian&lt;br&gt;
&lt;br&gt;
One way to do it is not to include the zero vectors in the first place. You can scan through the flow field and exclude those of zero value from being plotted, like this:&lt;br&gt;
&lt;br&gt;
function quiverTest(u,v)&lt;br&gt;
% Initialise arrays&lt;br&gt;
xx=[]; yy=[]; uu=[]; vv=[]; &lt;br&gt;
% Scan through all elements&lt;br&gt;
for i=1:size(u,1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for j=1:size(u,2)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if sqrt(u(i,j).^2+v(i,j).^2)~=0 % If it's a zero vector, ignore it, otherwise add it to the array&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xx=[xx i];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;yy=[yy j];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uu=[uu u(i,j)];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;vv=[vv v(i,j)];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end                &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
% Quiver and reverse the Y axis.&lt;br&gt;
quiver(xx,yy,uu,vv);&lt;br&gt;
set(gca,'YDir','reverse');&lt;br&gt;
&lt;br&gt;
Hope this helps,&lt;br&gt;
M&lt;br&gt;
&lt;br&gt;
&quot;Fab Braun&quot; &amp;lt;f1braun@hsr.ch&amp;gt; wrote in message &amp;lt;hcsn0u$s36$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; hi all!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; i'm dealing around with showing the optical flow of an image in a quiver plot.&lt;br&gt;
&amp;gt; so far no problem, except I haven't found a solution yet to completely remove zero valued vectors from the quiver plot.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; the following i read somewhere:&lt;br&gt;
&amp;gt; Vectors(Vectors == 0) = nan;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; bud this doesn't work 100%...because there is still a small point left everywhere i want to set these vectors to zero.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; any other ideas?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks in advance!&lt;br&gt;
&amp;gt; fabian</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 10:25:05 -0500</pubDate>
      <title>Re: hide vectors in quiver plot completely</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265009#692641</link>
      <author>Fab Braun</author>
      <description>Hi Mohd,&lt;br&gt;
&lt;br&gt;
Great, Thanks a lot!&lt;br&gt;
That was exactly what i was looking for...&lt;br&gt;
&lt;br&gt;
i implemented it a bit in a different way than you suggested - no for loops --&amp;gt; not that slow!&lt;br&gt;
&lt;br&gt;
% get all the valid flow vectors - might add some additional conditions here&lt;br&gt;
ValidIndex = (abs(FlowVectors) ~= 0);  &lt;br&gt;
&lt;br&gt;
% plot only valid flow vectors&lt;br&gt;
quiver(GridX(ValidIndex), GridY(ValidIndex), ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;real(FlowVectors(ValidIndex)), -imag(FlowVectors(ValidIndex)));&lt;br&gt;
&lt;br&gt;
than you very much!&lt;br&gt;
fabian</description>
    </item>
  </channel>
</rss>

