- accept all outputs by using hcell(t==iii) instead.
- handle the multiple matches (e.g. throw an error).
- fix the indexing to ensure that there is only one true index.
- capture the comma separated list using multiple output arguments:
matlab error Too many outputs requested. Most likely cause is missing [] around left hand side that has a comma separated list expansion
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Here is my code
for iii=1:num_patch
%lims=0;
flag=0;
for jjj=1:numel(cellsrc)
if(iii== cellsrc(jjj))
flag=1;
end
end
if(flag==0)
if(lim<=len)
im = hcell{(t==iii)};
x={}; % empty cell which will consist all blocks
dct_img=blkproc(im,[8,8],@dct2);% DCT of image using 8X8 block
m=dct_img; % Sorce image in which watermark will be inserted
temp={};
[values,cell1,R,C]=segmentImg1(m,8,8);
x=cell1;
k=0;
blockcapacity=R*C;
lims=1;
while(lim<=len)
k=k+1;
kx=(x{k}); % Extracting block into kx for processing
for i=1:8 % To address row of block
for j=1:8 % To adress column of block
if (i==8) && (j==8)% Eligiblity condition to insert watremark
% i=1 and j=1 - means embedding element in first bit of every block
kx(i,j)=rr(lim);
end
end
end
x{k}=kx; kx=[];
lim=lim+1;
lims=lims+1;
if(lims>blockcapacity)
break;
end
end
x=desegment(x,48,48);
x=(blkproc(x,[8 8],@idct2));
hcell{(t==iii)}=x;
end
end
end
Here am dividing an image into blocks of 48*48 size, total image size is 144*144. Am trying to embed the data into this block using dct. when am trying to embed lengthier data, at the 17th block it showing error like,
Too many outputs requested. Most likely cause is missing [] around left hand side that has a comma separated list expansion.
Error in main (line 134)
im = hcell{(t==iii)}; please help me as soon as possible.
0 comentarios
Respuestas (1)
Stephen23
el 20 de Jun. de 2016
Editada: Stephen23
el 20 de Jun. de 2016
When t==iii has two or more true values, then this code
hcell{(t==iii)}
>> C = {1,2,3};
>> C{[false,false,true]} % only one true index -> one output
ans = 3
>> C{[true,false,true]} % two true values -> comma separated list
ans = 1
ans = 3
>> out = C{[true,false,true]} % try this!
However you only wrote one output variable, so there is a mismatch between the number of items in this comma separated list and the number of output arguments. Thus the error. To resolve this you could:
[val1,val3] = C{[true,false,true]}
3 comentarios
Stephen23
el 20 de Jun. de 2016
@ANJU PS: then find out why the seventeenth block causes this error, and fix it. Use the debugging tools to help you.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!