Cannot generate code for indexing expression where the index has unknown size and underlying cell array is not homogeneous.

Hi,
I am trying to generate code for clusterDetections algorithms. But i'm getting errors for unknown size.
Please someone guide mw how to solve this. i'm attaching the screenshots of the error for reference

댓글 수: 3

It looks to me as if detections is a cell array of struct. Why not just use a struct array?
i used struct array instead of cell array of struct. error in the cluster detections cleared.
But i am passing the detectedClusters to updateTracks function. where it is not taking struct array as inputs. i'm getting function call failed error.
How do i proceed with this?
It appears that updateTracks does expect a cell array of detections, so you will have to switch back to that.
I also see that for code generation, "All the detections used with a multi-object tracker must have properties with the same sizes and types".
I am far from sure, but it looks to me as if the detections you were creating might be different sizes -- you are generating your meas2D based upon the content of the image, and maybe the number of pixels covered need to be the same for each of the objects ??
This is speculation, something you could try; I have never used that toolbox.

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

답변 (1개)

Hi Vimal,
I understand that the function 'updateTracker' is not accepting arguments of type struct array during code generation.
Since C/C++ are statically typed languages, the fields, their types and sizes of the structure variables/arguments should be known at compile time for code generation to succeed.
In your case, the fields of the structure you are passing into the function is unknown at compile time, since it is dependent on the output of the 'clusterDetections' function that is known at run time.
If the fields of the structure is known and do not change, try predefining the variable 'detectionClusters' as an struct array and pass it as an argument into the function 'updateTracker'.
The following documentation page gives more insights on implementing the same.
Hope this helps.

댓글 수: 1

Thanks Prasanth,
We have solved that particular issue long back but we are having problem concatenating the cell array during the code generation. Is there any we can code generation can support cell array concatenation. Attaching the screenshot for your reference. Please let me know how to solve this

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

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 7월 17일

댓글:

2020년 11월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by