% creating strings example

% get input from user
name = input('Please enter your name: ','s');
age = input('Please enter your age: ');

% method 1: fprintf
fprintf('My name is %s and I am %d years old.\n',name,age);

% method 2: constructing a string and using a display statement
message = ['My name is ' name ' and I am ' num2str(age) ' years old.'];
disp(message);

% method 3: constructing a string and using a msgbox
message = ['My name is ' name ' and I am ' num2str(age) ' years old.'];
msgbox(message);