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 [4258×1 double], I would like to produce a [4258×10 double] for all trials. Many thanks.
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 [4258×1 double], I would like to produce a [4258×10 double] for all trials. Many thanks.
The easiest way to do this is with a loop that counts i = 1:10 and have a matrix that is 4258×10. 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