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

1 visualización (últimos 30 días)
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 comentarios
Vimal Prasath
Vimal Prasath el 20 de Jul. de 2020
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 el 20 de Jul. de 2020
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.

Iniciar sesión para comentar.

Respuestas (1)

Prasanth
Prasanth el 24 de Nov. de 2020
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 comentario
Vimal Prasath
Vimal Prasath el 25 de Nov. de 2020
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

Iniciar sesión para comentar.

Categorías

Más información sobre Structures en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by