text2int1.m
来自「vigenere密码解密的matlab实现」· M 代码 · 共 25 行
M
25 行
function y = text2int1 (x)% This function takes the letter in the string x and converts % it to an integer. % The convention for this function is% ' ' --> 0% a --> 1% b --> 2% and so on...[s1,s2]=size(x);yvec=x - 'a'+1; inds=find(yvec<1);yvec(inds)=zeros(size(inds)); % set all the spaces to a value of 0% Now we must convert to a numbery=zeros(s1,1);for k=1:s1,for j=0:s2-1, ind=s2-j; y(k)=y(k)+yvec(k,ind)*100^(j); end;end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?