How to calculate GPA in row Matrix and using For loop?

2 ビュー (過去 30 日間)
Vishal Mahendran
Vishal Mahendran 2022 年 6 月 4 日
回答済み: Maneet Kaur Bagga 2022 年 7 月 5 日
How to calculate GPA in row Matrix and using For loop in MATLAB?
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2022 年 6 月 5 日
What have you tried yet? What does the data look like? What is the method to calculate GPA?

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

回答 (1 件)

Maneet Kaur Bagga
Maneet Kaur Bagga 2022 年 7 月 5 日
As per my understanding you want to calculate the Grade Point Average of a row matrix using for loop. Assuming the method for calculating the GPA is taking out the mean of the given data and returning it as the final result. You can refer to the code below for reference. Hope it helps!
x = [2,5,9,8,7.5,4.9]
x = 1×6
2.0000 5.0000 9.0000 8.0000 7.5000 4.9000
len = length(x)
len = 6
sum=0
sum = 0
for(i=1:len)
sum = sum + x(i)
end
sum = 2
sum = 7
sum = 16
sum = 24
sum = 31.5000
sum = 36.4000
sum = sum/len
sum = 6.0667

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by