Home Questions Extracting data from c3d_data in Matlab

Extracting data from c3d_data in Matlab

DWQA QuestionsCategory: KINARM DataExtracting data from c3d_data in Matlab
Duncan McLean Staff asked 8 years ago

Apologies in advance as this question is not KINARM specific, but a general Matlab question. I have created a task that record ten trials. I wish to extract the 'Right_HandX(i)' for i=1:10 from c3d_data(1) such that I have a matrix of values for all trials.

i.e, if each trial produces a [4258x1 double], I would like to produce a [4258x10 double] for all trials. Many thanks.

2 Answers
Duncan McLean Staff answered 8 years ago
Apologies in advance as this question is not KINARM specific, but a general Matlab question. I have created a task that record ten trials. I wish to extract the 'Right_HandX(i)' for i=1:10 from c3d_data(1) such that I have a matrix of values for all trials.

i.e, if each trial produces a [4258x1 double], I would like to produce a [4258x10 double] for all trials. Many thanks.
Koloman Varady Staff answered 6 years ago
The easiest way to do this is with a loop that counts i = 1:10 and have a matrix that is 4258x10. With each iteration of the loop you can fill the rows one at a time. If your trials aren't all the same length (for example, if they're not all 4258 elements long), you could find the longest trial and make your matrix have that many columns. The other trials could be padded with 0 or NaN. For example, 1 2 0 0 0 1 2 3 4 5 1 2 3 4 0 Cheers, Koloman