MATLAB Answers

Variable is not fully defined on some execution paths.

21 views (last 30 days)
Poornima Asuti
Poornima Asuti on 17 Jul 2019
Commented: Poornima Asuti on 18 Jul 2019
I have written a matlab code for dividing an image into smaller parts. While using the HDL coder, I am getting an error "Variable 'tcell2{1, 1}' is not fully defined on some execution paths".
%%croping the image and storing the values in a cell
t=1;
tcell2=cell(10,10);
for y=0:100:900
s=1;
for z=0:100:900
final=imcrop(pic2,[(z+1) (y+1) width height]);
tcell2{t,s}=final;
s=s+1;
end
t=t+1;
end
%%taking mean of the elements in a matrix and storing values in a cell
for i=1:1:10
for l=1:1:10
mtcell2{i,l}=mean2(tcell2{i,l});%% getting an error over here
end
end

  2 Comments

KALYAN ACHARJYA
KALYAN ACHARJYA on 17 Jul 2019
%%croping the image and storing the values in a cell and mean of each cell element
If this is the objective, then you can do it by more simpler way.

Sign in to comment.

Accepted Answer

Jan
Jan on 17 Jul 2019
Edited: Jan on 17 Jul 2019
Does this help?
tcell2 = cell(10,10);
for t = 1:10
for s = 1:10
tcell2{t,s} = imcrop(pic2, ...
[(t-1)*100 + 1, (s-1)*100 + 1, width, height]);
end
end

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.