MATLAB: I have a 29*3 table. Column 1 is for height (cm), Column 2 is for mass (kg), Column 3 is for body fat (kg). How to divide body fat by mass to find out bf as a % of total body mass

biomechanicsdivisionhelploopmatlab function

VarName1 VarName2 VarName3
________ ________ ________
156.2 52.8 17.28
162.8 70.4 20.55
167 71.5 17.81
159.2 58.5 18.03
167.5 51.7 12.1
165.8 65.1 16.89
166.1 54.8 9.74
173.2 76.8 20.83
176.9 61 16.97
172 85.1 25.66
163.6 57.7 25.33
186.5 88.9 20.79
180.2 85.7 22.28
161.6 40.8 6.06
162 38.5 5.71
177.2 80 23.54
186.8 97.2 20.82
157 46.4 1
165 52.7 3
184 60.3 8
176 63.2 6.9
163 44 3.9
168 56.3 6.5
172 64.7 9.8
168 69.7 12.6
183 70.6 9.6
168.5 53.8 6.1
172 73.5 15.9
169 62 3.2
>> size(dataset1)
ans =
29 3

Best Answer

T{:,3}./T{:,2} %T is your table , no need loops to perform this