generate random upper string in function
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!