title: Matlab: Invalid field name for structure array
body: <p>Basically, my programs is supposed to accept votes, saved by name of the voter id, until the secret id is entered, at which point it will display the id. It has to be saved as a structure array. Here is what I've got so far:</p>
  
  <pre><code>secretid = 123456789;
  currid = 0;
  while currid ~= secretid
    currid = input('Enter your id:');
    if currid == secretid
      votedata
      break
    else
      strcurrid = num2str(currid);
      vote = input('Enter your vote:', 's');
      votedata = struct(strcurrid, vote);
    end
  end
  </code></pre>
  
  <p>According to Matlab, the field name is invalid - it must be saved as a string, but I don't understand, I converted currid to a string, and don't see why it isn't working.</p>