i get an error .whats wrong ? Subscript indices must either be real positive integers or logicals. Error in (line 54) CC(j)=bitxor(mode(R(ii)+CC(j-1),256),K(i));
1 次查看(过去 30 天)
显示 更早的评论
II= imread('camera man.png');
R =II(:)';
x(1)=0.27;
q=0.3;
for i=2:65736;
if x(i-1)>=0 & x(i-1)<q
x(i)=(x(i-1)/q);
elseif x(i-1)>=q & x(i-1)<=0.5
x(i)=(x(i-1)-q)/(0.5-q);
else
x(i)=(1-x(i-1));
end
end
N=201;
X=[x(N:end)];
L=65536;
flag=zeros(1,L);
T =[1:L];
T=flag;
j=mod(floor(X*1e15),L)+1;
if (j==i)|(flag(j)==1)
j=mod(floor(X*1e15),L)+1;
else
flag(j)=1; T=j;
end
%Y=R(j);
x=0.3;
p=0.343;
for n=2:65536;
if x(n-1)>=0 & x(n-1)<=p
x(n)=x(n-1)/p;
else
x(n)=(1-x(n-1))/(1-p);
end
end
for i=1:numel(x)
K(i)= mod(floor((x(i)*10^2-floor(x(i)*10^2))*10^3),256);
end
for i=1:numel(K)
if K(i)<3
K(i)=K(i)+3;
end
end
for n=1:L;
if mod(n,2)
ii(n)=ceil(n/2);
else
ii(n)=(L-n/2+1);
end
end
CC(1)=150;
for r=1:2
if r==1
CC(j)=bitxor(mode(R(ii)+CC(j-1),256),K(i));
else
CC(j)=bitxor(mod(Y(ii)+CC(j-1),256),K(i));
end
end
%ZZZ=reshape(CC,[256,256]);
%imshow(ZZZ);
%%imhist(CC);
%entropy(CC);
0 个评论
回答(2 个)
Aiswarya Subramanian
2019-7-8
Hello,
On the line 54, you have put 'mode', which is not the same as 'mod'. I guess that is the issue. Hope that helps :)
KSSV
2019-7-8
CC(j)=bitxor(mode(R(ii)+CC(j-1),256),K(i));
The above line got multiple issues. YOu need to rethink your code. Think of the following:
- j is of size 1X65536, but your CC is growing in loop and is of size 1X1 for the first time ogf loop. So error.
- min(j) id 1, and (j-1) gives 0, index cannot be zero.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!