Extract data from columns based on a range from one column.

1 回表示 (過去 30 日間)
Neuromechanist
Neuromechanist 2023 年 2 月 20 日
コメント済み: Neuromechanist 2023 年 2 月 20 日
Hello,
I have a set of data from some 2D motion analysis software. When processing the videos, one can apply time markers at events of interest, such as gait onset and gait termination (coded as 0 and 99, respectively). When exporting the data, the data is arranged as: time, 2nd column is irrelevant, event markers, variables of interest (each column of variables of interest can be angles, distance changes, etc., based on how you processed the video.)
I'm looking to extract data in columns 1 and 4 through 7, within the range between gait onset (0) and gait termination (99) in the marker column. There are 5 total ranges (i.e. 0 and 99) to extract from this trial. I've tried searching for some ways, but the examples don't really match up with how my data set looks.
Any ideas or leads to start will be greatly appreciated! I've attached the data set incase my description doesn't make sense.
If this problem is pretty basic, I'm willing to learn from any fundamentals you recommend. Thanks in advance.
  2 件のコメント
Matt J
Matt J 2023 年 2 月 20 日
What form is the data to have once it is extracted?
Neuromechanist
Neuromechanist 2023 年 2 月 20 日
I'm not sure if I'm answering your question correctly, but once the data is extracted, I'll use those sets to calculate velocity, acceleration, etc., so I guess continuous. I like that the cell sorts out each of the cycles that were marked, I didn't think about that. I appreciate your assistance!

サインインしてコメントする。

採用された回答

Matt J
Matt J 2023 年 2 月 20 日
A=readmatrix('data.xlsx');
starts=find(A(:,3)==0);
stops=find(A(:,3)==99);
N=numel(starts); assert(numel(stops)==N, 'Missing markers');
C=cell(N,1);
for i=1:N
C{i}=A(starts(i):stops(i),[1,4:7]);
end
C
C = 5×1 cell array
{ 815×5 double} { 982×5 double} {1092×5 double} { 623×5 double} {1267×5 double}

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by