Several problem:
1. = is an operator for assignment in MATLAB. For comparison, you need to use ==
2. You want to compare the value to character 'y', just writing y means that you are referring to a variable
3. It is more of a suggestion, but it us better to use strcmp() for char arrays
Best Answer