Constant value for System object constructor problem

조회 수: 2 (최근 30일)
Jonathan
Jonathan 2014년 9월 24일
댓글: Denis Gurchenkov 2014년 9월 26일
I'm trying to use the hough transform, local maxima and hough lines algorithms in the computer vision toolbox of MATLAB so as to be able to then generate C code from a MATLAB function. I'm essentially initializing the object multiple times through a for loop to apply hough algorithms on multiple segments of an image.
However in trying to generate code with codegen, I get this error message
'Cannot compute constant value for argument for this System object constructor. All arguments to the constructor of this System object must be constants for code generation...'
since I'm trying to use different input properties for different segments of an image. I've now put all these different values for each iteration into an array in the function encapsulating the Hough algorithms and tried to address a different row each time i call the function. It still doesn't work of course.
Is the issue here that a system object constructor cannot be called multiple times or that I must find a way of making my input parameters for the system object constructor constant. In the case of the latter, how do I go about doing it? I've read about coder.const but they seem to only take a function as an argument but I just merely need to select the corresponding row from a fixed array.
  댓글 수: 2
Sean de Wolski
Sean de Wolski 2014년 9월 24일
Can you show us a code snippet?
Denis Gurchenkov
Denis Gurchenkov 2014년 9월 26일
Hi Jonathan, can you please post the example that you have? I think your problem can be resolved by using coder.unroll() on the loop and re-creating the object afresh inside each loop iteration. If you post the example, it'd be much easier for us suggest a fix.

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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by