我在解密部分遇到问题(不是真正的加密)
prompt = 'Enter a sentence you would like to Encrypt';
dlg_title = 'Input';
num_lines = 5;
defaultans = {'Hello'};
answer = inputdlg(prompt,dlg_title,num_lines,defaultans);
answer = answer{1};
% find out how big the square matrix for data should be
for i = 1:length(answer) % it should never run this far anyway
if (i^2) > length(answer)
break;
end
end
mat_len = i;
% predefine square matrix of numbers forcing matrixA to number type
matrixA = zeros(mat_len,mat_len);
% iterate through square matrix assigning answer values to positions
for i = 1:mat_len
for j = 1:mat_len
if (((i-1)*mat_len)+j) <= length(answer)
matrixA(i,j) = answer(((i-1)*mat_len)+j);
else
break;
end
end
end
matrixA(1)=matrixA(1)*10
matrixA'
我的问题是我不知道如何将矩阵恢复为字符串。比如
720 108 0
101 111 0
108 0 0
当输入代码时应该是&#34; Hello&#34;,但我不知道该做什么或如何启动解密部分,我怎样才能将ASCII代码输回到matlab并得到字符串?