Matlab相关更快的代码示例

时间:2015-05-03 03:53:38

标签: matlab

以下代码运行非常慢的输入是两个矩阵大小256x256x3。任何人都可以告诉我如何改进相同的

[row col byt]=size(img_encryp);
    decryp_value=zeros(row,col,3);
    img_encryp = cast(img_encryp,'int32');
     ca1=cast(ca1,'int32');
    for i=1:row
        for j=1:col
            for z=1:3

                % Encryption
                c=de2bi(img_encryp(i,j,z),16);
                d=de2bi(ca1(i,j,z),16);

                for k=1:incr:8
                    c1=bi2de(c(k:k+incr-1));
                    c2=bi2de(d(k:k+incr-1));
                    result=mod((c1-c2),2.^incr);
                    temp_bin(k:k+incr-1)=de2bi(result,incr);   
                end
                decryp_value(i,j,z)=bi2de(temp_bin);

            end

        end

0 个答案:

没有答案