Calculate Mean Score of subjects
3 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I need help with reading .txt files and calculate the mean score for subjects. There are four tests, we only want the average of test 1, test 3, and test 4 accross all four subject (1_1, 2_2, 3_3, 4_4). If the subject is absent for that specific test, we marked as '1', for example subject 1_1 is absent for 'test 4' 30 days ago.
If the subject is absent for 'test n' 30 days ago and 30 days after, we will not calculate the average score for this subject. However, if the subject is absent for 'test n' 30 days ago but present 30 days after, we will still calculate the average score for this subject.
Only 4 subject in this data set only, but we are expanding the numbers of data (expecting to be 1000 subjects)
0 件のコメント
採用された回答
Seth Furman
2021 年 11 月 10 日
You can
1) find the mean across several variables using mean(t{:, ["Var1", "Var2", "Var3"]}, 2)
2) find rows that meet a certain condition (e.g. absent for both tests) by using logical indexing such as t{t.Condition1 & t.Condition2, "Mean"} = missing.
t = array2table(randi(10, 3, 4))
t.Mean = mean(t{:, ["Var1", "Var2", "Var3"]}, 2)
t{t.Var1 > 5 & t.Var2 > 5, "Mean"} = missing
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!