BEGINNER PROBLEM: Trying to finish up an assignment but I am stuck with this error and am not sure how to fix

1 view (last 30 days)
Error: "Unable to perform assignment because the left and right sides have a different number of elements."
It occurs at line 117 where I type the following:
final(i)=cast((lab_total+assign_total+exam_total)+0.5,'int64');
grade_before_check=final(i);
I have attached the code. I am trying to make a code that calculates grades for a class pulling data from a text file. Both are attached

Answers (1)

James Tursa
James Tursa on 31 Jan 2019
Edited: James Tursa on 31 Jan 2019
lab_total and assign_total and exam_total are all vectors, so the right hand side expression is a vector. You try to stuff that vector into a single element of final, hence the error.
What is the point of casting this to a uint64?

Tags

Community Treasure Hunt

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

Start Hunting!