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:
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
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.