how to remove the error"braces indexing not suitable for this kind of variables"?

2 views (last 30 days)
i have the follawing matrix watermarking code
it has some error i need to remove it
clc
ca=input('enter the matrix')
count=1;
location_array=[[1,4;3,3],[2,3;4,1],[1,6;3,5],[1,5;3,4],[3,4;6,1],[4,3;5,2],[4,2;5,1],[2,6;3,6]];
for i=1:size(ca,1)-1
for j=1:size(ca,2)-1
A=ca(i,j);
B=dct2(A)
dis_img{1,count}=B
count =count+1;
end
end
bin_store={}
watermarked=12
b=de2bi(watermarked)
bin_store=b
count=1;
key=[2,4,5,8];
j=1;
s=200;
for i=1:size(bin_store,2)
block=dis_img(1,count);
if bin_store(1,i)==0
for j=1:4
ii=location_array{1,key(1,j)}(1,:);
jj=location_array{1,key(1,j)}(2,:);
xx=block(ii(1,1),ii(2,1));
yy=block(jj(1,1),jj(1,1));
if xx<=yy
x=xx;
xx=yy;
yy=x;
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
else
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
end
end
block(ii(1,1),ii(1,1))==xx;
block(jj(1,1),jj(1,1))==yy;
end
end
if bin_store(1,i)==1
for j=1:4
ii=location_array{1,key(1,j)}(1,:);
jj=location_array{1,key(1,j)}(2,:);
xx=block(ii(1,1),ii(1,1));
yy=block(jj(1,1),jj(1,1));
ifxx>=yy
x=xx;
xx=yy;
yy=x;
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
else
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
end
end
block(ii(1,1),ii(1,1))==xx;
block(jj(1,1),jj(1,1))==yy; end
end
dis_img(1,count)=block
count=count+1;
end
embed_image=[]
count=1;
for i=1:size(ca,2)-1
hori=[]
for j=1:size(ca,1)-1
xt=dis_img{1,count};
xt=idct2(xt);
hori=horzcat(hori,xt);
count=count+1
end
embed_image=vertcat(embed_image,hori);
end
end
output=embed_image
error that is coming is
Brace indexing is not supported for variables of this type.
Error in watermark (line 25)
ii=location_array{1,key(1,j)}(1,:);

Accepted Answer

Image Analyst
Image Analyst on 20 Feb 2022
location_array is not a cell array or table so you cannot use curly braces. See the FAQ:

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!