title: How can I write output of MATLAB to MS Word?
body: <p>I am reading the input of the MATLAB code from an Excel file using <code>xlsread</code>, after the calculation I am exporting to Word for writing out the report(writetoword.m). In Excel, there is a string which I should read in MATLAB and output in Word. </p>
  
  <p>In Excel file(input.xlsx) it is written 'shoe'.</p>
  
  <p>I read using </p>
  
  <pre><code>[num,txt,raw] = xlsread('input.xlsx');
  eng = txt(14,19); % the word 'shoe' in that excel cell
  </code></pre>
  
  <p>In <code>writetoword.m</code>, I wrote,</p>
  
  <pre><code>test = eng;
  WordText(ActXWord,test,Style,[0,1]);
  
  function WordText(actx_word_p,text_p,style_p,enters_p,color_p)
      if(enters_p(1))
          actx_word_p.Selection.TypeParagraph;
      end
      actx_word_p.Selection.Style = style_p;
      if(nargin == 5)
          actx_word_p.Selection.Font.Color=color_p;     
      end
  
      actx_word_p.Selection.TypeText(text_p);
      actx_word_p.Selection.Font.Color='wdColorAutomatic';
      for k=1:enters_p(2)    
          actx_word_p.Selection.TypeParagraph;
      end
  return
  </code></pre>
  
  <p>It is not printing anything. The error is in the line</p>
  
  <pre><code>actx_word_p.Selection.TypeText(text_p);
  </code></pre>
  
  <p>now if I write </p>
  
  <pre><code>test = 'eng';
  WordText(ActXWord,test,Style,[0,1]);
  </code></pre>
  
  <p>It will come as eng and not shoe.</p>
  
  <p>How can I fix this problem?</p>