Codegen complaining about cell-array assignement
显示 更早的评论
Hello,
I am trying to generate a MEX file from my code, but I can't seem to figure out why codegen reports this error. I've tried to work around the problem in several ways but nothing seems to work. What i'm trying to do is constructing a cell array which entries are cells themselves.
Specifically, codegen says the following:
"every cell-array element contained in 'allvalues' (must) be assigned ... Check assignements to element(s) allvalues{:},allvalues{:}{1,1} ... allvalues{:}{1,4}."
The code is the following:
function rehash(obj)
allkeys=getkeys(obj);
%Get all values
allvalues=dim_singleton_cell(length(allkeys));
for j=1:size(allvalues,1)
%Get all values
[temp,~]=get(obj,allkeys(j));
allvalues{j}=temp;
end
newcapacity=ceil(2*obj.capacity);
obj.capacity=newcapacity;
clear(obj);
%Rehash
putAll(obj,allkeys,allvalues);
end
allvalues is a {N,1} cell array (the coder.Type is [Inf x 1] ) where each entry is a {1x4} cell array (coder.Type is [1x4]). The function dim_singleton_cell creates a {N,1} cell array with entries {int32(-1),...,int32(-1)}.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Code Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!