Extract 3D positions from C3D data

test = c3dserver;
openc3d(test);
XYZPOS = get3dtargets(test)
field = fieldnames(XYZPOS)
for frame_id= 1:4588
 position = [];
 for i = 1:length(field)
 pos = getfield(XYZPOS,field{i});
 position = [position; pos(frame_id,:)];
 end
 file_name = sprintf('position_%d.txt',frame_id);
 dlmwrite(file_name, position, '\t')
end
%disp(position);

First, install the C3D server:

https://www.motion-labs.com/software_c3d_c3dserver.html

 


Invalid field name: ‘liu:LKNE’.

Error in get3dtargets (line 59)
XYZPOS.(newstring) = …

or

Invalid field name: ’01’.
Error in ==> get3dtargets at 56
XYZPOS.(newstring) = …

Because one of the Field names is actually ‘liu0x3ALKNE’ which contains a number.

 

Solution:

 

In the get3dtargets.m, add a new line before

 

(newly added)newstring = genvarname(newstring);
(line 58)XYZPOS.(newstring) =
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s