I'm trying to convert a function to C++ in Matlab Coder.. There is a cell variable and while building mex it gives an error.
R=cell(1,n);
for i=1:wi
for j=1:hi
if(cin(i,j)>0)
k=cin(i,j);
for x=i-2*rx+1:i+2*rx-1
for y=j-2*ry+1:j+2*ry-1
if(x>=1 && y>=1 && x<=wi && y<=hi)
R{k}=[R{k}, (x-1)*wi+y];
end
end
end
end
end
end
It gives error on R{k}=[R{k}, (x-1)*wi+y]; part
'Attempt to access an element that was not defined before use.'
Anybody can help me about this?