title: Working with XLSWRITE in MATLAB: How do I delete empty cells?
body: <p>I am generating an Excel file through MATLAB and I have empty cells in the middle of it. Here is the code I am using to initialize an empty matrix:</p>
  
  <pre><code>newfile = cell(5,5);
  [newfile{:}] = deal('');
  [newfile{:}] = deal(' ');
  </code></pre>
  
  <p>I then do some processing and write the data to a file using XLSWRITE. The spreadsheet ends up having some empty cells and some data. Is there a command by which I can delete the empty rows, without effecting the rows which have data in them?</p>
  
  <p>Another question:</p>
  
  <p>Is there a way to append onto this Excel file? I run this file everyday and would like to automatically add data rather than manually copying and pasting everyday.</p>
  
  <p>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  Addition to above question:</p>
  
  <p>If my output file looks like </p>
  
  <blockquote>
    <p>1.8        3           -4.7   </p>
    
    <p>1.87   3.9 -5.8   </p>
    
    <p>1.84   2.8 -4.3   </p>
    
    <p>2  3.2 -4.7</p>
    
    <p>2  3.7 -6<br>
    2  3.6 -5.2<br>
    3  4.3 -6.5   </p>
    
    <p>13 4.2 13.1   </p>
    
    <p>12 3.5 -6.3   </p>
    
    <p>1.65   1.9 -4.4   </p>
  </blockquote>
  
  <p>So how do i delete the empty rows when its not in cell as cellfun does not work for this</p>