If the user enters a vector of numbers separated by spaces or commas, in response to an input() statement that does not have an 's', then that a syntax error for input()
... I was certain it didn't used to work that way, but now that I go back to test, it seems to have been true since at least R2015b.
So... use the 's' option to input, and parse the result such as with sscanf() . And make sure to count the number of values before trying to do the next line, as the user might not have entered enough values.