How do I acquire the states of 20 detections simultaneously using matlab function?

1 view (last 30 days)
Hello, using cameras I am detecting vehicles and I have the measurement data in a nested struct in a bus. This data has the states of the vehicles in terms of [x,y,z,vx,vy,vz] and this data is in a 300x1 struct (Picture "struct") and in that struct is the measurement values of all 300 detections allowed but only 20 of the matrices are nonzero values, which are the only vehicles around my vehicle (20 vehicles). The states are in a double time series (Picture "double_timeseries") and comes in a 6x1 matrix (Picture "Data).
The function im using is in the (Picture "function") which comes after the Detection concatenation (Picture "model") block. The function works but only outputs zeros.
"struct"
"Double timeseries"
"Data"
"Function"
"Model"
  2 Comments
Walter Roberson
Walter Roberson on 12 Sep 2023
Is Detections(i).Measurement something that can be multiplied by a double precision array (code), or is it something that has a field or property named Data (screen capture) ?
Marshall Botta
Marshall Botta on 12 Sep 2023
Edited: Marshall Botta on 12 Sep 2023
Well Detection(i).Measurement is the double timeseries but opens up the common properties then i have to do Detections(1).Measurement.Data to actually get that data, in the matlab workspace specifically.
I am not familiar with double preicision array (code) but what it seems like, from the Matlab documents, a 1x1 struct.
But the Detection(1).Measurement comes in a 1x1 double time series and the data property is a 6x1x201 so if the double preicision array is a double array of 300x2. You couldnt multiply them from my knowledge of linear algebra.
If i understand your question correctly.
Thank you for the reponse!

Sign in to comment.

Answers (1)

Githin George
Githin George on 6 Oct 2023
Hello Marshall,
I would suggest using the debugging workflow for ‘MATLAB function block’ to clearly observe the input structure for ‘fcn’ function. Further, verify that the state values are updating correctly and are non-zero as expected during the simulation.
The following link describes debugging workflow for ‘MATLAB function block.
I hope this helps.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!