Matlab coder error : This expression has size [:? x 1] ?
23 ビュー (過去 30 日間)
古いコメントを表示
Hi While using matlab coder codegen. I am getting following error.
Why output of find command is uncertain?
1 件のコメント
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
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!