MATLAB: How do i write an input statement asking the user to enter their birthdate as a matrix with entries of month,day, year

input statementmatrix

Is this possible without using, else, if statements?
This is what i have.
clc
clear
name=input('Enter your name: ','s');
Choice=menu('Do you live in South Carolina?','yes','no');
bdayprompt=input('Enter your birthday in the format[month day year]: ');
birthdate=[bdayprompt];
fprintf('%s was born on %d.',name,birthdate)
Thanks

Best Answer

If the user follows instructions, birthdate will be a vector of three numbers, so you need the format string to print out three numbers using three %d fields. E.g.,
fprintf('%s was born on %d %d %d.\n',name,birthdate)
You might make it explicit in your instructions that the user needs to type in the square brackets surrounding the three numbers. E.g.,
disp('In the following prompt, be sure to type in the square brackets surrounding your birthday numbers.')