Matlab coder error : This expression has size [:? x 1] ?

조회 수: 7 (최근 30일)
JAI PRAKASH
JAI PRAKASH 2018년 10월 28일
편집: Walter Roberson 2018년 10월 28일
Hi While using matlab coder codegen. I am getting following error.
Why output of find command is uncertain?
  댓글 수: 1
dpb
dpb 2018년 10월 28일
편집: dpb 2018년 10월 28일
Because zoomMax could be empty if all(zoom~=6)==True
I don't have codegen so I don't know if it is smart enough to read the second optional argument or not but even if it is, that isn't enough to guarantee the length of the return is one and only one element.

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

답변 (2개)

Walter Roberson
Walter Roberson 2018년 10월 28일
편집: Walter Roberson 2018년 10월 28일
dpb is correct that zoomMax could be empty.
Even if it is not empty, J(1:zoomMax) would be variable length, leading positionX to be variable length, along with a number of other expressions on the following lines, right through to halfpx being variable length.
All of those variables need to be either noted with coder.varsize() or else need to be pre-initialized such as
N = numel(zoom);
positionX = zeros(1, N);
because it is legal with codegen to make an array shorter (by assigning something smaller to it) but not to have it be variable sized without configuring it specially.

JAI PRAKASH
JAI PRAKASH 2018년 10월 28일
I just change
Line 12 with
zoom = zoom(zoom>0 & zoom<=6);
zoomMax = length(zoom);
And matlab coder shows no error, its working fine.. :)
Thanks for your comments

카테고리

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

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by