title: Print A Matlab Struct to a Text File
body: <p>I have a Matlab program which generates a set of very large structs as its output.<br>
  The structs are sufficiently large that I would like to be able to print the text representations to a text file for later study.</p>
  
  <p>I.e., the command:</p>
  
  <blockquote>
    <p>foo(1)</p>
  </blockquote>
  
  <p>sends the first of the structs to the screen, but the structure is too large to fit in the scroll window, and the scroll window is a poor tool for looking at such a large block of text, anyway.  I would like to be able to pipe the output of that command directly to a text file. </p>
  
  <p>Unfortunately, fprintf is not defined for some elements in the struct, and so fprintf fails.  Likewise, I believe the WriteStructsToText.m script, which is part of the Psychtoolbox library, also fails. </p>
  
  <p>Is there any way to force Matlab to just dump what it is displaying on the screen directly into a text file?</p>