Matlab:假设1-26分别代表a-z二十六个字母

2024-11-01 21:05:40
推荐回答(2个)
回答1:

function str=dec2char(num)
s=num+96;
str=char(s);

祝你学习愉快!

回答2:

S=[25 15 21 8 1 22 5 20 15 2 5 12 9 5 22 5 9 14 25 15 21 18 19 5 12 6 20 8 1 20 9 19 20 8 5 19 5 3 18 5 20 15 6 19 21 3 3 5 19 19];
S1=S+96;
>> char(S1)

ans =

youhavetobelieveinyourselfthatisthesecretofsuccess

you have to believe in yourself that is the secret of success
----------------------------------------------
function code=decode(x)
x=x+96;
code=char(x);
--------------------------------------

x=[25 15 21 8 1 22 5 20 15 2 5 12 9 5 22 5 9 14 25 15 21 18 19 5 12 6 20 8 1 20 9 19 20 8 5 19 5 3 18 5 20 15 6 19 21 3 3 5 19 19];
decode(x)