1. String to ASCII code using abs()
abs('a');
abs(' ');
2. Use char() to convert ASCII code to string
char(97);
char(32);
3. How to create a fixed-length string of all spaces?
Because you can use ones ( 1 , N ) ones(1, N)ones(1,N ) generates a fixed-length list, so you can use the conversion relationship between strings and ASCII codes to generate a list with all 32 elements, and then convert it to a string.
num_lis = 32 * ones(1, N);
str_all_space = char(num_lis);