Cell array not fully defined on some execution paths error

조회 수: 1 (최근 30일)
Zun Sid
Zun Sid 2018년 6월 24일
댓글: Zun Sid 2018년 6월 25일
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개)

Walter Roberson
Walter Roberson 2018년 6월 24일
assert(n < 1);
that creates an error unless n is 0 or negative, in which case cell(1,n) will always be the empty cell...
  댓글 수: 3
Zun Sid
Zun Sid 2018년 6월 25일
ok thankyou

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by