how can I create a struct with row vectors

I create a struct:
gt_tracks(num_gt_tracks) = struct('Position', [], 'Velocity', []);
for j = 1:num_gt_tracks
gt_tracks(j).Position = [gt(j,2:3), 0];
gt_tracks(j).Velocity = zeros(3,1);
end
but in this code:
OSPA(t) = OSPAMetric(tracks, gt_tracks);
OSPA requires 'Position' and 'Velocity' fields must be row vectors.
so what should i do?

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 11월 27일

0 개 추천

It is quite straightforward to create row vector components for a Structure array. E.g.:
t=linspace(0,13, 131);
GT.Pos = randi([-13, 13],1, 131);
GT.Vel = 2.5*t-5;

댓글 수: 2

Tianyu Cheng
Tianyu Cheng 2020년 11월 27일
could you please use my code to give me a example?
Tianyu Cheng
Tianyu Cheng 2020년 11월 27일
because the way i uesd create a column vector

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

카테고리

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

태그

질문:

2020년 11월 27일

댓글:

2020년 11월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by