How to extract the data in a column with the information of another column

3 ビュー (過去 30 日間)
Mario
Mario 2022 年 8 月 19 日
編集済み: Akira Agata 2022 年 8 月 20 日
Hello!!
I need to extract the force of right and left leg but in double contact phase. Each data is in different column, and I need to use the criteria of the double contact to extract the force of bouth legs.
Thanks for the help!!
xlsread('3kmFES_001a.xlsx')
ans = 10000×10
1.0e+04 * NaN NaN 4.4776 0 0 0.0534 0 0.0001 0.0001 0 NaN NaN 0.0000 0.0001 0 0.0534 0 0.0001 0.0001 0 NaN NaN 0.1000 0.0002 0 0.0534 0 0.0001 0.0001 0 0.0054 NaN 1.0000 0.0003 0 0.0533 0 0.0001 0.0001 0 0.0152 NaN NaN 0.0004 0 0.0533 0 0.0001 0.0001 0 2.9455 NaN 0 0.0005 0 0.0533 0 0.0001 0.0001 0 0.0042 NaN NaN 0.0006 0 0.0533 0 0.0001 0.0001 0 NaN NaN 0.0008 0.0007 0 0.0533 0 0.0001 0.0001 0 0.0054 NaN 0.0016 0.0008 0 0.0533 0 0.0001 0.0001 0 NaN NaN 0.0016 0.0009 0 0.0532 0 0.0001 0.0001 0
  1 件のコメント
Matt J
Matt J 2022 年 8 月 19 日
I don't think anyone here knows what "the criteria of the double contact" is. Also, your posted data has 10 unlabeled columns. We don't know which ones are the force or for which leg.

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

採用された回答

Voss
Voss 2022 年 8 月 19 日
t = readtable('3kmFES_001a.xlsx')
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
t = 10000×11 table
subjItem subjValue CalItem CalValue Time_ms_ LEFT_Fz_N_ RIGHT_Fz_N_ LEFT_Contact RIGHT_Contact SingleContact DoubleContact _____________________ _________ ___________________________ ________ ________ __________ ___________ ____________ _____________ _____________ _____________ {'last name' } NaN {'Date' } 44776 0 0 534.06 0 1 1 0 {'first name' } NaN {'Time' } 0.47939 1 0 533.84 0 1 1 0 {'sex' } NaN {'Sampling Freq (Hz)' } 1000 2 0 533.62 0 1 1 0 {'weight (kg)' } 53.7 {'# points' } 10000 3 0 533.41 0 1 1 0 {'height (cm)' } 152 {'start trigger' } NaN 4 0 533.21 0 1 1 0 {'birth date' } 29455 {'cells_dist (m)' } 0 5 0 533.03 0 1 1 0 {'age (years)' } 41.95 {'<Reserved>' } NaN 6 0 532.86 0 1 1 0 {'extra comment' } NaN {'PGA_V(z)' } 8 7 0 532.71 0 1 1 0 {'Plate weight (kg)'} 54.32 {'PGA_H(y)' } 16 8 0 532.57 0 1 1 0 {0×0 char } NaN {'PGA_L(x)' } 16 9 0 532.45 0 1 1 0 {0×0 char } NaN {'referential orientation'} -1 10 0 532.35 0 1 1 0 {0×0 char } NaN {'Direction' } 1 11 0 532.26 0 1 1 0 {0×0 char } NaN {'Slope (deg)' } 0 12 0 532.19 0 1 1 0 {0×0 char } NaN {'Forces Filtering' } NaN 13 0 532.13 0 1 1 0 {0×0 char } NaN {'Filter_Z_cutoff (Hz)' } NaN 14 0 532.08 0 1 1 0 {0×0 char } NaN {'Filter_Y_cutoff (Hz)' } NaN 15 0 532.05 0 1 1 0
t_LR_F_Double = t(t.DoubleContact == 1,{'RIGHT_Fz_N_' 'LEFT_Fz_N_'})
t_LR_F_Double = 2724×2 table
RIGHT_Fz_N_ LEFT_Fz_N_ ___________ __________ 526.56 1.7354 525.67 3.6512 524.8 5.7631 523.97 8.0888 523.18 10.648 522.41 13.463 521.68 16.557 520.98 19.956 520.29 23.688 519.62 27.779 518.96 32.259 518.29 37.156 517.6 42.5 516.89 48.318 516.13 54.637 515.33 61.481
  1 件のコメント
Akira Agata
Akira Agata 2022 年 8 月 20 日
編集済み: Akira Agata 2022 年 8 月 20 日
+1
It's better to set "VariableNamingRule" option of readtable function to "preserve" to avoid unexpected warning message, like:
% Read data from Excel file
T = readtable("3kmFES_001a.xlsx", "VariableNamingRule", "preserve");
% Row index of "Double Contact" == 1
idx = T.("Double Contact") == 1;
% Extract the target data
T_out = T(idx, ["LEFT_Fz (N)", "RIGHT_Fz (N)"]);

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by