title: Matlab convert string "aaa" to ["a", "a", "a"] array
body: <p>So I'm working in Matlab and having a real problem trying to understand how strings work in Matlab.</p>
  
  <p>Basically I'm trying to load a string into a double array in its binary version.</p>
  
  <p>So basically i want to load "a" and get [0 1 1 0 0 0 0 1] out.</p>
  
  <p>I have the following below that converts a string to its binary representation but this only leads to me having "a" = ["01100001"] when I convert it to an array and [1100001] when converted to a number using str2num</p>
  
  <pre><code>    function loadString(obj, string)
          binaryString = reshape(dec2bin(string, 8), 1, []);
  
      end
  </code></pre>
  
  <p>So basically I'm looking for a way to convert a string to an array of characters ie "aaa" -> ["a" "a" "a"]. That way I convert the binaryString to ["0" "1" "1" "0" "0" "0" "0" "1"] then convert that array using str2num.</p>