title: Is there a Matlab function to convert any data structure to a string?
body: <p>I'm looking for a function in Matlab to use for error messages, like so:</p>
  
  <pre><code>error(['Invalid value for someVariable: ' wantedFunction(someVariable)]);
  </code></pre>
  
  <p>I want <code>wantedFunction</code> to be able to take both strings, arrays, cell arrays, ideally even structure arrays. </p>
  
  <p>For now, I'm using <code>num2str</code>, but that doesn't work for cells. I thought what I want could be done with <code>sprintf</code>, but I haven't figured out how. I suppose I could write my own function, but that would be redundant if there already is a way to do this in Matlab. Any ideas?</p>