how to Specify the arguments of imfilter in codegen function ? how to call it with the right parameters ?
조회 수: 8 (최근 30일)
이전 댓글 표시
Hallo everybody,
i'm trying to optimize the run time of my App by getting imfilter function called as a C Code .
so first i used the following codegen code to creat a the C Liberies :
codegen -d imfilterlib -config:lib imfilter -args {zeros(3456,5184,'double'),zeros(399,399,'double')}
so im not sure if the input arugments here are the right one, for an Array 3456 x 5184 class double for the first argument for example.
the filles are generated and saved with out any problem
now when using coder.cval function calling the generated function comes allways the error that coder.cval function is not supported in Matlab.
coder.cinclude('imfilter_initialize.h');
coder.cinclude('imfilter.h');
coder.cinclude('imfilter_terminate.h');
coder.ceval('imfilter_initialize');
as showen in the screenshot :

is it something to do with the matlab version i did somthingwrong using the function. i would be very thankfull if you can help.
thanks a lot.
best regards
댓글 수: 0
답변 (2개)
Harsh
2025년 2월 23일
The “coder.ceval” function can only be used in the generated code. Therefore calls made to “coder.ceval” in MATLAB execution produce an error. You can include a check in your code to run the “coder.ceval” in generated code only by using the “coder.target” function. Below is a sample code snippet to do so:
if coder.target('MATLAB')
% Executing in MATLAB, call MATLAB equivalent of C function imfilter
else
% Executing in generated code, call C function imfilter
coder.updateBuildInfo('addIncludedPaths','$(START_DIR)\codegen\imfilterlib’);
coder.cinclude('imfilte.h');
y = coder.ceval('imfilter', coder.ref(double(app.ROI), double(mask)));
end
For more information regarding “coder.ceval” function, run the following command:
doc coder.ceval
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!