<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/248047</link>
    <title>MATLAB Central Newsreader - Ignoring an empty array</title>
    <description>Feed for thread: Ignoring an empty array</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, 01 Apr 2009 12:45:03 -0400</pubDate>
      <title>Ignoring an empty array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/248047#639337</link>
      <author>Phil </author>
      <description>Hi there.&lt;br&gt;
&lt;br&gt;
Here is my problem. I have 3 arrays, 2 full and one empty in the format below&lt;br&gt;
&lt;br&gt;
[15x1 double]    [0x1 double]    [24x1 double]&lt;br&gt;
&lt;br&gt;
1.) How can i ignore the empty array&lt;br&gt;
&lt;br&gt;
2.) But still recognise the order it is in i.e. [15x1 double] = 1st place, [0x1 double] = 2nd place and [24x1 double] = 3rd place.&lt;br&gt;
&lt;br&gt;
Can anyone help?&lt;br&gt;
&lt;br&gt;
Thanks in advance,&lt;br&gt;
&lt;br&gt;
Phil</description>
    </item>
    <item>
      <pubDate>Wed, 01 Apr 2009 13:28:01 -0400</pubDate>
      <title>Re: Ignoring an empty array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/248047#639347</link>
      <author>aasim Azooz</author>
      <description>&quot;Phil &quot; &amp;lt;harsh_classic@yahoo.co.uk&amp;gt; wrote in message &amp;lt;gqvnkf$5q8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi there.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here is my problem. I have 3 arrays, 2 full and one empty in the format below&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [15x1 double]    [0x1 double]    [24x1 double]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1.) How can i ignore the empty array&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 2.) But still recognise the order it is in i.e. [15x1 double] = 1st place, [0x1 double] = 2nd place and [24x1 double] = 3rd place.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can anyone help?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks in advance,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Phil&lt;br&gt;
&lt;br&gt;
See help squeeze&lt;br&gt;
Aasim Azooz</description>
    </item>
    <item>
      <pubDate>Wed, 01 Apr 2009 14:06:02 -0400</pubDate>
      <title>Re: Ignoring an empty array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/248047#639362</link>
      <author>Jos </author>
      <description>&quot;Phil &quot; &amp;lt;harsh_classic@yahoo.co.uk&amp;gt; wrote in message &amp;lt;gqvnkf$5q8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi there.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here is my problem. I have 3 arrays, 2 full and one empty in the format below&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [15x1 double]    [0x1 double]    [24x1 double]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1.) How can i ignore the empty array&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 2.) But still recognise the order it is in i.e. [15x1 double] = 1st place, [0x1 double] = 2nd place and [24x1 double] = 3rd place.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can anyone help?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks in advance,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Phil&lt;br&gt;
&lt;br&gt;
Are these arrays stored in a cell array? A lazy suggestion could be:&lt;br&gt;
&lt;br&gt;
% data&lt;br&gt;
C = {[1 2 3],[],[6 7 8 9 10]}&lt;br&gt;
&lt;br&gt;
% create a place vector&lt;br&gt;
place = C ;&lt;br&gt;
for i=1:numel(C),&lt;br&gt;
&amp;nbsp;t = place{i} ;&lt;br&gt;
&amp;nbsp;t(:) = i ;&lt;br&gt;
&amp;nbsp;place{i} = t ;&lt;br&gt;
end&lt;br&gt;
Result = [place{:} ; C{:}]&lt;br&gt;
&lt;br&gt;
More matlab-like alternatives could include cellfun, cell2struct etc. But it depends on what you need to do exactly, and what you mean by &quot;ignore the empty array&quot;?&lt;br&gt;
&lt;br&gt;
hth&lt;br&gt;
Jos</description>
    </item>
    <item>
      <pubDate>Wed, 01 Apr 2009 14:26:01 -0400</pubDate>
      <title>Re: Ignoring an empty array</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/248047#639369</link>
      <author>Phil </author>
      <description>&quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;gqvsc9$9kk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Phil &quot; &amp;lt;harsh_classic@yahoo.co.uk&amp;gt; wrote in message &amp;lt;gqvnkf$5q8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi there.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Here is my problem. I have 3 arrays, 2 full and one empty in the format below&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; [15x1 double]    [0x1 double]    [24x1 double]&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 1.) How can i ignore the empty array&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 2.) But still recognise the order it is in i.e. [15x1 double] = 1st place, [0x1 double] = 2nd place and [24x1 double] = 3rd place.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Can anyone help?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks in advance,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Phil&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Are these arrays stored in a cell array? A lazy suggestion could be:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % data&lt;br&gt;
&amp;gt; C = {[1 2 3],[],[6 7 8 9 10]}&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % create a place vector&lt;br&gt;
&amp;gt; place = C ;&lt;br&gt;
&amp;gt; for i=1:numel(C),&lt;br&gt;
&amp;gt;  t = place{i} ;&lt;br&gt;
&amp;gt;  t(:) = i ;&lt;br&gt;
&amp;gt;  place{i} = t ;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; Result = [place{:} ; C{:}]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; More matlab-like alternatives could include cellfun, cell2struct etc. But it depends on what you need to do exactly, and what you mean by &quot;ignore the empty array&quot;?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; hth&lt;br&gt;
&amp;gt; Jos&lt;br&gt;
&lt;br&gt;
Hi Jos,&lt;br&gt;
&lt;br&gt;
Many thanks for your help. I have managed to sort it now.&lt;br&gt;
&lt;br&gt;
Kind regards,&lt;br&gt;
&lt;br&gt;
Phil</description>
    </item>
  </channel>
</rss>

