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

1 次查看(过去 30 天)
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 个评论
Vimal Prasath
Vimal Prasath 2020-7-20
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?
Walter Roberson
Walter Roberson 2020-7-20
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 个)

Prasanth
Prasanth 2020-11-24
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 个评论
Vimal Prasath
Vimal Prasath 2020-11-25
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by