MATLAB: Matlab string size to asterisks

asteriskchardispreversestring

Hi there, I am taking an introduction to MATLAB course and I have been having trouble completing this task: "Write a program to input 2 strings from the user and to print out (i) the concatenation of the two strings with a space between them, (ii) a line of asterisks the same length as the concatenated strings, and (iii) the reversed concatenation. [Hint: use disp and char] and use the work done in Q2(a) above.
For example:
Enter string 1: Mark
Enter string 2: Huckvale
Mark Huckvale
*************
elavkcuH kraM "
I can do part (i), however when it comes to (ii) and (iii) I can't seem to get it. The hint says use char.. but I don't really know how to use it to display asterisks or reverse the string. Any guidance on this would be extremely helpful.
Thanks, Laura

Best Answer

Here's a hint:
x = 'Friday Rocks'
char(42+zeros(size(x)))
I found the 42 by running:
int8('*')
To reverse a string, look at fliplr.
doc fliplr