I tried to generate the same length of upper string as the input argument. For example, if I put wordscramble('abcd'), the length of the function should generate a four length upper string , like 'EFSA'. However, it seems doesnt work for it, is that any error in my codes?
function y = wordscramble(str)y = str2func(str);exchange = randperm(length(str));x = 0;y='';for i=1:length(str)y(i) = str(upper(exchange(i)));end
Best Answer