title: Get a string in fprintf output to display all characters
body: <p>I'm trying to write a matlab code to generate some kind of result page in a textfile but there seems to be some basic knowledge gap here (I'm new to matlab). So the thing that has me confused is how matlab handles strings. I thought I could create a vector full of strings e.g. <code>SampleNr = ['sample1','sample2'];</code> and later take that vector and print out to the file one specific element, e.g. <code>fprintf(fid, '%s', SampleNr(i));</code> but when I run this I only get the character in position <code>i</code> in the string instead of the whole string. As I said this is most likely me misunderstanding this concept, and searches on the mathworks site haven't made this clearer to me so I seek the collective wisdom of stackexchange. A MWE would be: </p>
  
  <pre><code> SampleNr = ['sample1','sample2'];
   sprintf('%s', SampleNr(2))
  </code></pre>
  
  <p>A method to get the whole string would be appreciated, but I would also like to have this confusion cleared up if possible, so in the future I can work confidently with strings in matlab. Thanks in advance.</p>