how to Specify the arguments of imfilter in codegen function ? how to call it with the right parameters ?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Harsh
il 23 Feb 2025 alle 23:10
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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!