Code:
r1=randi(1000,10, 1)
w=1000
c=0
sort(r1,'descend')
for i= 1:10
if r1(i)<=w
w=w-r1(i)
c=c+r1(i)
end
end
disp(w)
disp(c)
Image of the Code:

Image of Input and Output:

Explanation:
If the answer helped please upvote. It means a lot. For any query comment below.
Please use MATLAB You are given an array, weights, that contains the weights of some cargo...
Please help me answer all 3 questions in this case. The
numbers and questions asked, in this case, is different than the
other cases similar to it, so please don't copy and past other
answers from the same case. Also if you could please provide steps
to how you're getting the answers, if possible show it in excel
with formulas, please.
Answer the following questions using the information
provided above. Show all of your calculations in an Excel file.
Make...