Your code works, but you have to input the element as:
(with the quotation marks), not just
which Matlab tries to evaluate as a function or variable rather than a string.
If you want to get fancy you can also use
to ensure a sensible input string (this also allows you to input, for example just 'o' if one of your defined valid strings is 'oxygen' and it will convert 'o' to 'oxygen' on output, though, of course, just 'h' would be ambiguous.
By the way, your spelling of 'Hydrogen' is a little off too which may cause a failure if the user types it in correctly at the command line.