Borrar filtros
Borrar filtros

i get an error .whats wrong ? Subscript indices must either be real positive integers or logicals. Error in (line 54) CC(j)=bitx​or(mode(R(​ii)+CC(j-1​),256),K(i​));

1 visualización (últimos 30 días)
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);

Respuestas (2)

Aiswarya Subramanian
Aiswarya Subramanian el 8 de Jul. de 2019
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
KSSV el 8 de Jul. de 2019
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:
  1. 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.
  2. min(j) id 1, and (j-1) gives 0, index cannot be zero.

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by