title: Compare last characters of strings
body: <p>I need to compare the last characters of strings in matlab. Natively I would do the following:</p>
  
  <pre><code>string = 'foobar';
  len_string = length(string);
  if len_str_2 &gt;= 3
     str_suffix = str_2(len_str_2 - 2:len_str_2);
     strcmp('bar', str_suffix)
  end
  </code></pre>
  
  <p>Is there a simpler way to do this? With <code>strncmp</code> I can only compare the first <code>n</code> characters.</p>