Cell array not fully defined on some execution paths error

I'm trying to assign memory to all cells for the purpose of code conversion and getting an error "Variable 'x{1, n}' is not fully defined on some execution paths. " How do I fix this? %n=14
function z = mycell(n)
%#codegen
assert(n < 1);
x = cell(1,n);
for i = 1:n
x{i} = i;
end
z = x{n};
end

回答(1 个)

类别

帮助中心File Exchange 中查找有关 Matrices and Arrays 的更多信息

提问:

2018-6-24

评论:

2018-6-25

Community Treasure Hunt

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

Start Hunting!

Translated by