Creating new table from another table
8 ビュー (過去 30 日間)
古いコメントを表示
I have a 4 column table with ages, FEV values, Heights and the last has 1s or 0s. 1 means they smoke, 0 means they don't.
I need to make a new table with ages 11 and up, who smoke, and include their FEV values
0 件のコメント
採用された回答
Star Strider
2021 年 9 月 18 日
A relatively efficient way is just to do the comparisons to create a logical vector (‘Lv’ here), and go with that —
T0 = table(randi([5 90],20,1), 100*rand(20,1),randi([100 200],20,1),randi([0 1],20,1), 'VariableNames',{'Age','FEV_1','Height','Smokes'})
Lv = T0{:,1}>=11 & T0{:,4}==1;
T1 = T0(Lv,:)
Experiment to get different results.
.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で MATLAB Report Generator についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!