Code generation does not support MATLAB class 'images.in​ternal.cod​er.imref2d​' in this context?

조회 수: 10 (최근 30일)
When using an imref2d object as an input or output parameter to an entry function for C/C++ code generation, the following error is reported:
??? Code generation does not support MATLAB class 'images.internal.coder.imref2d' in this context because the class does not implement toRedirect() and/or fromRedirect() methods.
Simple Example(just for reproduce):
function imref = myfcn()%#codegen
imageSize = [100,200];
xlimtWorld = [-10,20];
ylimtWorld = [-20,50];
imref = imref2d(imageSize,xlimtWorld,ylimtWorld);
end
then use following command line to generate C/C++ code.
codegen -config:lib myfcn -report
it reports above issue.

채택된 답변

xingxingcui
xingxingcui 2022년 10월 26일
The correct approach is to convert matlab's built-in class object, imref2d, to struct types as output, e.g. these write a conversion function:
function outputStruct = helperToStructOutput(output)%#codegen
% input argument `output` is imref2d object.
outputStruct.ImageSize = output.ImageSize;
outputStruct.XWorldLimits = output.XWorldLimits;
outputStruct.YWorldLimits = output.YWorldLimits;
end

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by